/usr/include/GlobalArray.h is in libglobalarrays-dev 5.4~beta~r10636+dfsg-5.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef _GLOBALARRAY_H
#define _GLOBALARRAY_H
namespace GA {
class PGroup;
/**
* This is the GlobalArray class.
*/
class GlobalArray {
public:
/**
* Creates an ndim-dimensional array using the regular distribution
* model and returns integer handle representing the array.
* The array can be distributed evenly or not. The control over the
* distribution is accomplished by specifying chunk (block) size for all or
* some of array dimensions.
* For example, for a 2-dimensional array, setting chunk[0]=dim[0] gives
* distribution by vertical strips (chunk[0]*dims[0]);
* setting chunk[1]=dim[1] gives distribution by horizontal strips
* (chunk[1]*dims[1]). Actual chunks will be modified so that they are at
* least the size of the minimum and each process has either zero or one
* chunk. Specifying chunk[i] as <1 will cause that dimension to be
* distributed evenly.
* As a convenience, when chunk is specified as NULL, the entire array is
* distributed evenly.
* This is a collective operation.
* @param[in] type data type(MT_F_DBL,MT_F_INT,MT_F_DCPL)
* @param[in] ndim number of array dimensions
* @param[in] dims [ndim] array of dimensions
* @param[in] arrayname a unique character string
* @param[in] chunk [ndim] array of chunks, each element specifies
* minimum size that given dimensions should be chunked
* up into
*/
GlobalArray(int type, int ndim, int dims[], char *arrayname, int chunk[]);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],char*,int[])
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int dims[], char *arrayname, int chunk[],
PGroup* p_handle);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],char*,int[])
*/
GlobalArray(int type, int ndim, int64_t dims[], char *arrayname,
int64_t chunk[]);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],char*,int[])
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int64_t dims[], char *arrayname,
int64_t chunk[], PGroup* p_handle);
/**
* Creates an array by following the user-specified distribution.
*
* The distribution is specified as a Cartesian product of distributions
* for each dimension. The array indices start at 0. For example, the
* following figure demonstrates distribution of a 2-dimensional array 8x10
* on 6 (or more) processors. nblock[2]={3,2}, the size of map array is s=5
* and array map contains the following elements map={0,2,6, 0, 5}. The
* distribution is nonuniform because, P1 and P4 get 20 elements each and
* processors P0,P2,P3, and P5 only 10 elements each.
*
* <TABLE>
* <TR> <TD>5</TD> <TD>5</TD> </TR>
* <TR> <TD>P0</TD> <TD>P3</TD> <TD>2</TD> </TR>
* <TR> <TD>P1</TD> <TD>P4</TD> <TD>4</TD> </TR>
* <TR> <TD>P2</TD> <TD>P5</TD> <TD>2</TD> </TR>
* </TABLE>
*
* This is a collective operation.
*
* @param[in] type MA data type (MT_F_DBL,MT_F_INT,MT_F_DCPL)
* @param[in] ndim number of array dimensions
* @param[in] dims array of dimension values
* @param[in] arrayname a unique character string
* @param[in] block [ndim] no. of blocks each dimension is divided into
* @param[in] maps [s] starting index for for each block;
* the size s is a sum all elements of nblock array
*/
GlobalArray(int type, int ndim, int dims[], char *arrayname, int block[],
int maps[]);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],char*,int[],int[])
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int dims[], char *arrayname, int block[],
int maps[], PGroup* p_handle);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],char*,int[],int[])
*/
GlobalArray(int type, int ndim, int64_t dims[], char *arrayname,
int64_t block[], int64_t maps[]);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],char*,int[],int[])
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int64_t dims[], char *arrayname,
int64_t block[], int64_t maps[], PGroup* p_handle);
/**
* Creates an ndim-dimensional array with a layer of ghost cells around
* the visible data on each processor using the regular distribution model.
*
* The array can be distributed evenly or not evenly. The control over
* the distribution is accomplished by specifying chunk (block) size for
* all or some of the array dimensions. For example, for a 2-dimensional
* array, setting chunk(1)=dim(1) gives distribution by vertical strips
* (chunk(1)*dims(1)); setting chunk(2)=dim(2) gives distribution by
* horizontal strips (chunk(2)*dims(2)). Actual chunks will be modified
* so that they are at least the size of the minimum and each process
* has either zero or one chunk. Specifying chunk(i) as <1 will cause
* that dimension (i-th) to be distributed evenly. The width of the
* ghost cell layer in each dimension is specified using the array
* width(). The local data of the global array residing on each
* processor will have a layer width[n] ghosts cells wide on either
* side of the visible data along the dimension n.
*
* @param[in] type data type (MT_DBL,MT_INT,MT_DCPL)
* @param[in] ndim number of array dimensions
* @param[in] dims [ndim] array of dimensions
* @param[in] width [ndim] array of ghost cell widths
* @param[in] arrayname a unique character string
* @param[in] chunk [ndim] array of chunks, each element specifies
* minimum size that given dimensions should be
* chunked up into
* @param[in] ghosts this is a dummy parameter: added to increase the
* number of arguments, inorder to avoid the conflicts
* among constructors. (ghosts = 'g' or 'G')
*/
GlobalArray(int type, int ndim, int dims[], int width[], char *arrayname,
int chunk[], char ghosts);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],int[],char*,int[],char)
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int dims[], int width[], char *arrayname,
int chunk[], PGroup* p_handle, char ghosts);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],int[],char*,int[],char)
*/
GlobalArray(int type, int ndim, int64_t dims[], int64_t width[],
char *arrayname, int64_t chunk[], char ghosts);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],int[],char*,int[],char)
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int64_t dims[], int64_t width[],
char *arrayname, int64_t chunk[], PGroup* p_handle, char ghosts);
/**
* Creates an array with ghost cells by following the user-specified
* distribution.
*
* The distribution is specified as a Cartesian product of distributions
* for each dimension. For example, the following figure demonstrates
* distribution of a 2-dimensional array 8x10 on 6 (or more) processors.
* nblock(2)={3,2}, the size of map array is s=5 and array map contains
* the following elements map={1,3,7, 1, 6}. The distribution is
* nonuniform because, P1 and P4 get 20 elements each and processors
* P0,P2,P3, and P5 only 10 elements each.
*
* <TABLE>
* <TR> <TD>5</TD> <TD>5</TD> </TR>
* <TR> <TD>P0</TD> <TD>P3</TD> <TD>2</TD> </TR>
* <TR> <TD>P1</TD> <TD>P4</TD> <TD>4</TD> </TR>
* <TR> <TD>P2</TD> <TD>P5</TD> <TD>2</TD> </TR>
* </TABLE>
*
* The array width[] is used to control the width of the ghost cell
* boundary around the visible data on each processor. The local data
* of the global array residing on each processor will have a layer
* width[n] ghosts cells wide on either side of the visible data along
* the dimension n. This is a collective operation.
*
* @param[in] type data type (MT_DBL,MT_INT,MT_DCPL)
* @param[in] ndim number of array dimensions
* @param[in] dims [ndim] array of dimensions
* @param[in] width [ndim] array of ghost cell widths
* @param[in] arrayname a unique character string
* @param[in] block [ndim] no. of blocks each dimension is divided into
* @param[in] maps [s] starting index for for each block;
* the size s is a sum of all elements of nblock array
* @param[in] ghosts this is a dummy parameter: added to increase the
* number of arguments, inorder to avoid the conflicts
* among constructors. (ghosts = 'g' or 'G')
*/
GlobalArray(int type, int ndim, int dims[], int width[], char *arrayname,
int block[], int maps[], char ghosts);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],int[],char*,int[],int[],char)
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int dims[], int width[], char *arrayname,
int block[], int maps[], PGroup* p_handle, char ghosts);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],int[],char*,int[],int[],char)
*/
GlobalArray(int type, int ndim, int64_t dims[], int64_t width[],
char *arrayname, int64_t block[], int64_t maps[], char ghosts);
/**
* @copydoc GlobalArray::GlobalArray(int,int,int[],int[],char*,int[],int[],char)
* @param[in] p_handle processor group handle
*/
GlobalArray(int type, int ndim, int64_t dims[], int64_t width[],
char *arrayname, int64_t block[], int64_t maps[], PGroup* p_handle,
char ghosts);
/**
* Creates a new array by applying all the properties of another existing
* array.
*
* This is a collective operation.
*
* @param[in] arrayname a character string
* @param[in] g_a integer handle for reference array
*/
GlobalArray(const GlobalArray &g_a, char *arrayname);
/**
* Creates a new array by applying all the properties of another existing
* array.
*
* This is a collective operation.
*
* @param[in] g_a integer handle for reference array
*/
GlobalArray(const GlobalArray &g_a);
/**
* Creates a new array with no existing attributes.
*
* @note All attributes must subsequently be set using the "set" methods.
*
* This is a collective operation.
*/
GlobalArray();
/** Destructor */
~GlobalArray();
/* access the data */
/** @return the array handle */
int handle() const { return mHandle; }
/* Global Array operations */
/**
* Combines data from local array buffer with data in the global array
* section.
*
* @note The local array is assumed to be have the same number of dimensions
* as the global array.
*
* global array section (lo[],hi[]) += *alpha * buffer
*
* This is a one-sided and atomic operation.
*
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
* @param[in] buf pointer to the local buffer array
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
* @param[in] alpha scale factor (double/DoubleComplex/long *)
*/
void acc(int lo[], int hi[], void *buf, int ld[], void *alpha) const;
/**
* @copydoc GlobalArray::acc(int[],int[],void*,int[],void*)const
*/
void acc(int64_t lo[], int64_t hi[], void *buf, int64_t ld[], void *alpha) const;
/**
* Provides access to the specified patch of a global array.
*
* Returns array of leading dimensions ld and a pointer to the first element
* in the patch. This routine allows to access directly, in place
* elements in the local section of a global array. It useful for
* writing new GA operations. A call to ga_access normally follows a
* previous call to ga_distribution that returns coordinates of the
* patch associated with a processor. You need to make sure that the
* coordinates of the patch are valid (test values returned from
* ga_distribution).
*
* Each call to ga_access has to be followed by a call to either
* ga_release or ga_release_update. You can access in this fashion only
* local data. Since the data is shared with other processes, you need
* to consider issues of mutual exclusion. This operation is local.
*
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
* @param[out] ptr points to location of first element in patch
* @param[out] ld [ndim-1] leading dimensions for the pacth elements
*/
void access(int lo[], int hi[], void *ptr, int ld[]) const;
/**
* @copydoc GlobalArray::access(int[],int[],void*,int[])const
*/
void access(int64_t lo[], int64_t hi[], void *ptr, int64_t ld[]) const;
/**
* Provides access to the specified block of a global array that is using
* simple block-cyclic data distribution. Returns array of leading
* dimensions ld and a pointer to the first element in the patch. This
* routine allows user to access directly, in-place * elements in the
* local section of a global array. It useful for writing new GA
* operations. A call to ga_access normally follows a previous call to
* ga_distribution that returns coordinates of the patch associated with
* a processor. You need to make sure that the coordinates of the patch
* are valid (test values returned from * ga_distribution).
*
* Each call to ga_access_block has to be followed by a call to either
* ga_release_block or ga_release_block_update. You can access in this
* fashion only local data. Since the data is shared with other processes,
* you need to consider issues of mutual exclusion. This operation is
* local.
*
* @param[in] idx index of block
* @param[out] ptr points to location of first element in patch
* @param[out] ld [ndim-1] leading dimensions for the pacth elements
*/
void accessBlock(int idx, void *ptr, int ld[]) const;
/**
* @copydoc GlobalArray::accessBlock(int,void*,int[])const
*/
void accessBlock(int64_t idx, void *ptr, int64_t ld[]) const;
/**
* Provides access to the specified block of a global array that is using
* SCALAPACK type block-cyclic data distribution. Returns array of leading
* dimensions ld and a pointer to the first element in the patch. This
* routine allows user to access directly, in-place * elements in the
* local section of a global array. It useful for writing new GA
* operations. A call to ga_access_block normally follows a previous call to
* ga_distribution that returns coordinates of the patch associated with
* a processor. You need to make sure that the coordinates of the patch
* are valid (test values returned from * ga_distribution).
*
* Each call to ga_access_block_grid has to be followed by a call to either
* ga_release_block_grid or ga_release_block_grid_update. You can access in
* this fashion only local data. Since the data is shared with other
* processes, you need to consider issues of mutual exclusion. This
* operation is local.
*
* @param[in] index [ndim] indices of block in processor grid
* @param[out] ptr points to location of first element in patch
* @param[out] ld [ndim-1] leading dimensions for the pacth elements
*/
void accessBlockGrid(int index[], void *ptr, int ld[]) const;
/**
* @copydoc GlobalArray::accessBlockGrid(int[],void*,int[])const
*/
void accessBlockGrid(int64_t index[], void *ptr, int64_t ld[]) const;
/**
* Provides access to the local data of a global array that is using
* either the simple or SCALAPACK type block-cyclic data distribution.
* Returns the length of the local data block and a pointer to the first
* element. This routine allows user to access directly, in-place
* elements in the local section of a global array. It useful for writing
* new GA operations.
*
* Each call to ga_access_segment has to be followed by a call to either
* ga_release_segment or ga_release_segmentupdate. You can access in
* this fashion only local data. Since the data is shared with other
* processes, you need to consider issues of mutual exclusion. This
* operation is local.
*
* @param[in] index processor ID
* @param[out] ptr points to location of first element
* @param[out] len length of locally held data
*/
void accessBlockSegment(int index, void *ptr, int *len) const;
/**
* @copydoc GlobalArray::accessBlockSegment(int,void*,int*)const
*/
void accessBlockSegment(int index, void *ptr, int64_t *len) const;
/**
* Provides access to the local patch of the global array. Returns
* leading dimension ld and and pointer for the data. This routine
* will provide access to the ghost cell data residing on each processor.
* Calls to accessGhosts should normally follow a call to
* distribution that returns coordinates of the visible data patch
* associated with a processor. You need to make sure that the coordinates
* of the patch are valid (test values returned from distribution).
*
* You can only access local data.
* This is a local operation.
*
* @param[out] dims [ndim] array of dimensions of local patch,
* including ghost cells
* @param[out] ptr returns an index corresponding to the origin the global
* array patch held locally on the processor
* @param[out] ld [ndim-1] physical dimensions of the local array patch,
* including ghost cells
*/
void accessGhosts(int dims[], void *ptr, int ld[]) const;
/**
* @copydoc GlobalArray::accessGhosts(int[],void*,int[])const
*/
void accessGhosts(int64_t dims[], void *ptr, int64_t ld[]) const;
/**
* This function can be used to return a pointer to any data element
* in the locally held portion of the global array and can be used to
* directly access ghost cell data. The array subscript refers to the
* local index of the element relative to the origin of the local
* patch (which is assumed to be indexed by (0,0,...)).
*
* This is a local operation.
*
* @param[out] ptr index pointing to location of element
* indexed by subscript[]
* @param[in] subscript [ndim] array of integers that index desired element
* @param[out] ld [ndim-1] array of strides for local data patch.
* These include ghost cell widths.
*/
void accessGhostElement(void *ptr, int subscript[], int ld[]) const;
/**
* @copydoc GlobalArray::accessGhostElement(void*,int[],int[])const
*/
void accessGhostElement(void *ptr, int64_t subscript[], int64_t ld[]) const;
/**
* The arrays are aded together elemet-wise:
* [for example: g_c.add(...,g_a, .., g_b);]
* c = alpha * a + beta * b
* The result c may replace one of he input arrays(a/b).
* This is a collective operation.
*
* @param[in] alpha scale factor
* @param[in] g_a array
* @param[in] beta scale factor
* @param[in] g_b array
*/
void add(void *alpha, const GlobalArray * g_a,
void *beta, const GlobalArray * g_b) const;
/**
* Patches of arrays (which must have the same number of elements) are
* added together element-wise.
* c[ ][ ] = alpha * a[ ][ ] + beta * b[ ][ ].
*
* This is a collective operation.
*
* @param[in] alpha scale factor
* @param[in] g_a global array
* @param[in] alo patch of g_a
* @param[in] ahi patch of g_a
* @param[in] beta scale factor
* @param[in] g_b global array
* @param[in] blo patch of g_b
* @param[in] bhi patch of g_b
* @param[in] clo patch of this GlobalArray
* @param[in] chi patch of this GlobalArray
*/
void addPatch(void *alpha, const GlobalArray * g_a, int alo[], int ahi[],
void *beta, const GlobalArray * g_b, int blo[], int bhi[],
int clo[], int chi[]) const;
/**
* @copydoc GlobalArray::addPatch(void*,const GlobalArray*,int[],int[],void*,const GlobalArray*,int[],int[],int[],int[])const
*/
void addPatch(
void *alpha, const GlobalArray * g_a, int64_t alo[], int64_t ahi[],
void *beta, const GlobalArray * g_b, int64_t blo[], int64_t bhi[],
int64_t clo[], int64_t chi[]) const;
/**
* Allocate internal memory etc. to create a global array
*
* @return TODO
*/
int allocate() const;
/**
* This function can be used to preallocate internal buffers that are used by
* the gather, scatter and scatter accumulate calls. This avoids repeated
* memory allocations in these calls that can reduce performance. The value of
* nelems should be set to the maximum number of elements that will be moved
* in any single call.
*
* This is a local operation.
*
* @param[in] nelems The maximum number of elements that will be moved in
* any gather, scatter, scatter-accumulate call
*/
void allocGatscatBuf(int nelems) const;
/**
* Check that the global array handle g_a is valid ... if not call
* ga_error with the string provided and some more info.
*
* This operation is local.
*
* @param[in] string message
*/
void checkHandle(char* string) const;
/**
* Compares distributions of two global arrays.
*
* This is a collective operation.
*
* @param[in] g_a GlobalArray to compare
*
* @return 0 if distributions are identical and 1 when they are not.
*/
int compareDistr(const GlobalArray *g_a) const;
/**
* Copies elements in array represented by g_a into the array
* represented by g_b [say for example: g_b.copy(g_a);].
* The arrays must be the same type, shape, and identically aligned.
*
* This is a collective operation.
*
* @param[in] g_a GlobalArray to copy
*/
void copy(const GlobalArray *g_a) const;
/**
* Copies elements in a patch of one array (ga) into another one (say for
* example:gb.copyPatch(...,ga,....); ).
*
* The patches of arrays may be of different shapes but must have the same
* number of elements. Patches must be nonoverlapping (if gb=ga).
*
* trans = 'N' or 'n' means that the transpose operator should not be
* applied. trans = 'T' or 't' means that transpose operator should be
* applied. This is a collective operation.
*
* @param[in] trans see above
* @param[in] ga global array
* @param[in] alo ga patch coordinates
* @param[in] ahi ga patch coordinates
* @param[in] blo this GlobalArray's patch coordinates
* @param[in] bhi this GlobalArray's patch coordinates
*/
void copyPatch(char trans, const GlobalArray* ga, int alo[], int ahi[],
int blo[], int bhi[]) const;
/**
* @copydoc GlobalArray::copyPatch(char,const GlobalArray*,int[],int[],int[],int[])const
*/
void copyPatch(
char trans, const GlobalArray* ga, int64_t alo[], int64_t ahi[],
int64_t blo[], int64_t bhi[]) const;
/**
* Computes element-wise dot product of the two arrays which must be of
* the same types and same number of elements.
* return value = SUM_ij a(i,j)*b(i,j)
*
* This is a collective operation.
*
* @param[in] g_a GlobalArray operand
*/
double ddot(const GlobalArray * g_a) const;
/**
* Computes the element-wise dot product of the two (possibly transposed)
* patches which must be of the same type and have the same number of
* elements.
*
* @param[in] ta transpose flags
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] g_a global array
* @param[in] tb transpose flags
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
*/
double ddotPatch(char ta, int alo[], int ahi[], const GlobalArray * g_a,
char tb, int blo[], int bhi[]) const;
/**
* @copydoc GlobalArray::ddotPatch(char,int[],int[],const GlobalArray*,char,int[],int[]const
*/
double ddotPatch(
char ta, int64_t alo[], int64_t ahi[], const GlobalArray * g_a,
char tb, int64_t blo[], int64_t bhi[]) const;
/**
* Deallocates the array and frees any associated resources.
*/
void destroy();
/**
* Performs one of the matrix-matrix operations:
* [say: g_c.dgemm(..., g_a, g_b,..);]
*
* C := alpha*op( A )*op( B ) + beta*C, \n
* where op( X ) is one of \n
* op( X ) = X or op( X ) = X', \n
* alpha and beta are scalars, and A, B and C are matrices, with op( A )
* an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.
* On entry, transa specifies the form of op( A ) to be used in the
* matrix multiplication as follows:\n
* ta = 'N' or 'n', op( A ) = A. \n
* ta = 'T' or 't', op( A ) = A'. \n
*
* This is a collective operation.
*
* @param[in] ta transpose operators
* @param[in] tb transpose operators
* @param[in] m number of rows of op(A) and of matrix C
* @param[in] n number of columns of op(B) and of matrix C
* @param[in] k number of columns of op(A) and rows of matrix op(B)
* @param[in] alpha scale factors
* @param[in] g_a input arrays
* @param[in] g_b input arrays
* @param[in] beta scale factors
*/
void dgemm(char ta, char tb, int m, int n, int k, double alpha,
const GlobalArray *g_a, const GlobalArray *g_b,double beta) const;
/**
* @copydoc GlobalArray::dgemm(char,char,int,int,int,double,const GlobalArray*,const GlobalArray*,double)const
*/
void dgemm(char ta, char tb, int64_t m, int64_t n, int64_t k, double alpha,
const GlobalArray *g_a, const GlobalArray *g_b,double beta) const;
/**
* Solve the generalized eigen-value problem returning all eigen-vectors
* and values in ascending order. The input matrices are not overwritten
* or destroyed.
*
* This is a collective operation.
*
* @param[in] g_s Metric
* @param[out] g_v Global matrix to return evecs
* @param[out] eval Local array to return evals
*
*/
void diag(const GlobalArray *g_s, GlobalArray *g_v, void *eval) const;
/**
* Solve the generalized eigen-value problem returning all eigen-vectors
* and values in ascending order. Recommended for REPEATED calls if g_s
* is unchanged. Values of the control flag:
*
* value action/purpose
*
* 0 indicates first call to the eigensolver
*
* >0 consecutive calls (reuses factored g_s)
*
* <0 only erases factorized g_s; g_v and eval unchanged
* (should be called after previous use if another
* eigenproblem, i.e., different g_a and g_s, is to
* be solved)
*
* The input matrices are not destroyed.
*
* This is a collective operation.
*
* @param[in] control Control flag
* @param[in] g_s Metric
* @param[out] g_v Global matrix to return evecs
* @param[out] eval Local array to return evals
*/
void diagReuse(int control, const GlobalArray *g_s, GlobalArray *g_v,
void *eval) const;
/**
* Solve the standard (non-generalized) eigenvalue problem returning
* all eigenvectors and values in the ascending order. The input matrix
* is neither overwritten nor destroyed.
*
* This is a collective operation.
*
* @param[out] g_v Global matrix to return evecs
* @param[out] eval Local array to return evals
*/
void diagStd(GlobalArray *g_v, void *eval) const;
/**
* TODO
*/
void diagSeq(const GlobalArray * g_s, const GlobalArray * g_v,
void *eval) const;
/**
* TODO
*/
void diagStdSeq(const GlobalArray * g_v, void *eval) const;
/**
* If no array elements are owned by process 'me', the range is returned
* as lo[]=-1 and hi[]=-2 for all dimensions.
*
* The operation is local.
*
* @param[in] me process number
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
*/
void distribution(int me, int* lo, int* hi) const;
/**
* @copydoc GlobalArray::distribution(int,int*,int*)const
*/
void distribution(int me, int64_t* lo, int64_t* hi) const;
/**
* TODO
*/
float fdot(const GlobalArray * g_a) const;
/**
* TODO
*/
float fdotPatch(
char t_a, int alo[], int ahi[], const GlobalArray * g_b,
char t_b, int blo[], int bhi[]) const;
/**
* @copydoc GlobalArray::fdotPatch(char,int[],int[],const GlobalArray*,char,int[],int[])const
*/
float fdotPatch(
char t_a, int64_t alo[], int64_t ahi[], const GlobalArray * g_b,
char t_b, int64_t blo[], int64_t bhi[]) const;
/**
* Assign a single value to all elements in the array.
*
* This is a collective operation.
*
* @param[in] value pointer to the value of appropriate type
* (double/DoubleComplex/long) that matches array type.
*/
void fill(void *value) const;
/**
* Fill the patch with value of 'val'
*
* This is a collective operation.
*
* @param[in] lo patch of this GlobalArray
* @param[in] hi patch of this GlobalArray
* @param[in] val value to fill
*
*/
void fillPatch (int lo[], int hi[], void *val) const;
/**
* @copydoc GlobalArray::fillPatch(int[],int[],void*)const
*/
void fillPatch (int64_t lo[], int64_t hi[], void *val) const;
/**
* This function can be used to free preallocate internal buffers that were
* set using the allocGatscatBuf call.
*
* This is a local operation.
*/
void freeGatscatBuf();
/**
* Gathers array elements from a global array into a local array.
* The contents of the input arrays (v, subscrArray) are preserved,
* but their contents might be (consistently) shuffled on return.
*
* @code
* for(k=0; k<= n; k++){
* v[k] = a[subsArray[k][0]][subsArray[k][1]][subsArray[k][2]]...;
* }
* @endcode
*
* This is a one-sided operation.
*
* @param[in] n number of elements
* @param[in] v [n] array containing values
* @param[in] subsarray [n][ndim] array of subscripts for each element
*/
void gather(void *v, int * subsarray[], int n) const;
/**
* @copydoc GlobalArray::gather(void*,int*[],int)const
*/
void gather(void *v, int64_t * subsarray[], int64_t n) const;
/**
* Copies data from global array section to the local array buffer. The
* local array is assumed to be have the same number of dimensions as the
* global array. Any detected inconsitencies/errors in the input arguments
* are fatal.
*
* Example: For ga_get operation transfering data from the [10:14,0:4]
* section of 2-dimensional 15x10 global array into local buffer 5x10
* array we have: lo={10,0}, hi={14,4}, ld={10}
*
* One-side operation.
*
* @param[in] lo [ndim] array of starting indices for global array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[out] buf pointer to the local buffer array where the data goes
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
*/
void get(int lo[], int hi[], void *buf, int ld[]) const;
/**
* @copydoc GlobalArray::get(int[],int[],void*,int[])const
*/
void get(int64_t lo[], int64_t hi[], void *buf, int64_t ld[]) const;
/**
* The function retrieves the number of blocks along each coordinate dimension
* and the dimensions of the individual blocks for a global array with a
* block-cyclic data distribution.
*
* This is a local operation.
*
* @param[out] num_blocks [ndim] array containing number of blocks along each
* coordinate direction
* @param[out] block_dims [ndim] array containing block dimensions
*/
void getBlockInfo(int num_blocks[], int block_dims[]);
/**
* This function returns 1 if the global array has some dimensions for
* which the ghost cell width is greater than zero, it returns 0 otherwise.
*
* This is a local operation.
*
* @return 1 if this GlobalArray has some dimensions for which teh ghost
* cell width is greater than zero; 0 otherwise
*/
int hasGhosts() const;
/**
* Computes element-wise dot product of the two arrays which must be of
* the same types and same number of elements.
*
* This is a collective operation.
*
* @param[in] g_a GlobalArray
* @return value = SUM_ij a(i,j)*b(i,j)
*/
int idot(const GlobalArray * g_a) const;
/**
* Computes the element-wise dot product of the two (possibly transposed)
* patches which must be of the same type and have the same number of
* elements.
*
* @param[in] ta transpose flags
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] g_a global array
* @param[in] tb transpose flags
* @param[in] blo this GlobalArray's patch coordinates
* @param[in] bhi this GlobalArray's patch coordinates
*/
long idotPatch(
char ta, int alo[], int ahi[], const GlobalArray * g_a,
char tb, int blo[], int bhi[]) const;
/**
* @copydoc GlobalArray::idotPatch(char,int[],int[],const GlobalArray*,char,int[],int[])const
*/
long idotPatch(
char ta, int64_t alo[], int64_t ahi[], const GlobalArray * g_a,
char tb, int64_t blo[], int64_t bhi[]) const;
/**
* Returns data type and dimensions of the array.
*
* This operation is local.
*
* @param[out] type data type
* @param[out] ndim number of dimensions
* @param[out] dims array of dimensions
*/
void inquire(int *type, int *ndim, int dims[]) const;
/**
* @copydoc GlobalArray::inquire(int*,int*,int[])const
*/
void inquire(int *type, int *ndim, int64_t dims[]) const;
/**
* Returns the name of an array represented by the handle g_a.
*
* This operation is local.
*
* @return copy of the name of this GlobalArray
*/
char* inquireName() const;
/**
* Computes element-wise dot product of the two arrays which must be of
* the same types and same number of elements.
*
*
* This is a collective operation.
*
* @param[in] g_a array handle
*
* @return value = SUM_ij a(i,j)*b(i,j)
*/
long ldot(const GlobalArray * g_a) const;
/**
* Computes the element-wise dot product of the two (possibly transposed)
* patches which must be of the same type and have the same number of
* elements.
*
* @param[in] ta transpose flags
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] g_a global array
* @param[in] tb transpose flags
* @param[in] blo this GlobalArray's patch coordinates
* @param[in] bhi this GlobalArray's patch coordinates
*/
long ldotPatch(
char ta, int alo[], int ahi[], const GlobalArray * g_a,
char tb, int blo[], int bhi[]) const;
/**
* @copydoc GlobalArray::ldotPatch(char,int[],int[],const GlobalArray*,char,int[],int[])const
*/
long ldotPatch(
char ta, int64_t alo[], int64_t ahi[], const GlobalArray * g_a,
char tb, int64_t blo[], int64_t bhi[]) const;
/**
* Solves a system of linear equations
*
* A * X = B
*
* using the Cholesky factorization of an NxN double precision symmetric
* positive definite matrix A (epresented by handle g_a). On successful
* exit B will contain the solution X.
*
* This is a collective operation.
*
* @param[in] g_a coefficient matrix
*
* @return = 0 : successful exit\n
* > 0 : the leading minor of this order is not positive
* definite and the factorization could not be completed
*/
int lltSolve(const GlobalArray * g_a) const;
/**
* Return in owner the GA compute process id that 'owns' the data. If any
* element of subscript[] is out of bounds "-1" is returned.
*
* This operation is local.
*
* @param[in] subscript [ndim] element subscript
*
* @return ID of compute process which owns the data
*/
int locate(int subscript[]) const;
/**
* @copydoc GlobalArray::locate(int[])const
*/
int locate(int64_t subscript[]) const;
/**
* Return the list of the GA processes id that 'own' the data. Parts of the
* specified patch might be actually 'owned' by several processes. If lo/hi
* are out of bounds "0" is returned, otherwise return value is equal to the
* number of processes that hold the data. This operation is local.
*
* map[i][0:ndim-1] - lo[i]
*
* map[i][ndim:2*ndim-1] - hi[i]
*
* procs[i] - processor id that owns data in patch
* lo[i]:hi[i]
*
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
* @param[out] map [][2*ndim] array with mapping information
* @param[out] procs [nproc] list of processes that own a part of selection
*
* @return 0 if lo/hi are out of bounds, otherwise the number of processes
* holding data
*/
int locateRegion(int lo[], int hi[], int map[], int procs[]) const;
/**
* @copydoc GlobalArray::locateRegion(int[],int[],int[],int[])const
*/
int locateRegion(int64_t lo[], int64_t hi[], int64_t map[], int procs[]) const;
/**
* Solve the system of linear equations op(A)X = B based on the LU
* factorization.
*
* op(A) = A or A' depending on the parameter trans:
*
* trans = 'N' or 'n' means that the transpose operator should not
* be applied.
*
* trans = 'T' or 't' means that the transpose operator should be applied.
*
* Matrix A is a general real matrix. Matrix B contains possibly multiple
* rhs vectors. The array associated with the handle g_b is overwritten
* by the solution matrix X.
* This is a collective operation.
*
* @param[in] trans transpose or not transpose
* @param[in] g_a coefficient matrix
*/
void luSolve(char trans, const GlobalArray * g_a) const;
/**
* ga_matmul_patch is a patch version of ga_dgemm:
*
* C[cilo:cihi,cjlo:cjhi] := alpha* AA[ailo:aihi,ajlo:ajhi] *
* BB[bilo:bihi,bjlo:bjhi] ) +
* beta*C[cilo:cihi,cjlo:cjhi],
*
* where AA = op(A), BB = op(B), and op( X ) is one of
* op( X ) = X or op( X ) = X',
*
* Valid values for transpose arguments: 'n', 'N', 't', 'T'. It works
* for both double and DoubleComplex data tape.
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] ailo patch of g_a
* @param[in] aihi patch of g_a
* @param[in] ajlo patch of g_a
* @param[in] ajhi patch of g_a
* @param[in] bilo patch of g_b
* @param[in] bihi patch of g_b
* @param[in] bjlo patch of g_b
* @param[in] bjhi patch of g_b
* @param[in] cilo patch of g_c
* @param[in] cihi patch of g_c
* @param[in] cjlo patch of g_c
* @param[in] cjhi patch of g_c
* @param[in] alpha scale factors
* @param[in] beta scale factors
* @param[in] transa transpose operators
* @param[in] transb transpose operators
*/
void matmulPatch(char transa, char transb, void* alpha, void *beta,
const GlobalArray *g_a,
int ailo, int aihi, int ajlo, int ajhi,
const GlobalArray *g_b,
int bilo, int bihi, int bjlo, int bjhi,
int cilo, int cihi, int cjlo, int cjhi) const;
/**
* @copydoc GlobalArray::matmulPatch(char,char,void*,void*,const GlobalArray*,int,int,int,int,const GlobalArray*,int,int,int,int,int,int,int,int)const
*/
void matmulPatch(char transa, char transb, void* alpha, void *beta,
const GlobalArray *g_a,
int64_t ailo, int64_t aihi, int64_t ajlo, int64_t ajhi,
const GlobalArray *g_b,
int64_t bilo, int64_t bihi, int64_t bjlo, int64_t bjhi,
int64_t cilo, int64_t cihi, int64_t cjlo, int64_t cjhi) const;
/**
* nga_matmul_patch is a n-dimensional patch version of ga_dgemm:
*
* C[clo[]:chi[]] := alpha* AA[alo[]:ahi[]] *
* BB[blo[]:bhi[]]) +
* beta*C[clo[]:chi[]],
*
* where AA = op(A), BB = op(B), and op( X ) is one of
* op( X ) = X or op( X ) = X',
*
* Valid values for transpose arguments: 'n', 'N', 't', 'T'. It works
* for both double and DoubleComplex data tape.
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] alo array of patch of g_a
* @param[in] ahi array of patch of g_a
* @param[in] blo array of patch of g_b
* @param[in] bhi array of patch of g_b
* @param[in] clo array of patch of g_c
* @param[in] chi array of patch of g_c
* @param[in] alpha scale factors
* @param[in] beta scale factors
* @param[in] transa transpose operators
* @param[in] transb transpose operators
*/
void matmulPatch(char transa, char transb, void* alpha, void *beta,
const GlobalArray *g_a, int *alo, int *ahi,
const GlobalArray *g_b, int *blo, int *bhi,
int *clo, int *chi) const;
/**
* @copydoc GlobalArray::matmulPatch(char,char,void*,void*,const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,int*,int*)const
*/
void matmulPatch(char transa, char transb, void* alpha, void *beta,
const GlobalArray *g_a, int64_t *alo, int64_t *ahi,
const GlobalArray *g_b, int64_t *blo, int64_t *bhi,
int64_t *clo, int64_t *chi) const;
/**
* This function merges all values in a patch of a mirrored array into
* a patch in another global array g_b.
*
* This is a collective operation.
*
* @param[in] alo [ndim] patch indices of mirrored array
* @param[in] ahi [ndim] patch indices of mirrored array
* @param[in] blo [ndim] patch indices of result array
* @param[in] bhi [ndim] patch indices of result array
* @param[out] g_a global array containing result
*/
void mergeDistrPatch(int alo[], int ahi[], GlobalArray *g_a,
int blo[], int bhi[]);
/**
* @copydoc GlobalArray::mergeDistrPatch(int[],int[],GlobalArray*,int[],int[])
*/
void mergeDistrPatch(int64_t alo[], int64_t ahi[], GlobalArray *g_a,
int64_t blo[], int64_t bhi[]);
/**
* This function returns 0 if a global array is not mirrored and 1 if it is.
*/
int isMirrored();
/**
* This function adds together all copies of a mirrored array so that all
* copies are the same.
*
* This is a collective operation.
*/
void mergeMirrored();
/**
* Non-blocking accumalate operation. This is function performs an
* accumulate operation and returns a nblocking handle. Completion of the
* operation can be forced by calling the nbwait method on the handle.
*
* This is a onesided operation.
*
* @param[in] lo [ndim] patch coordinates of block
* @param[in] hi [ndim] patch coordinates of block
* @param[in] buf local buffer containing data
* @param[in] ld [ndim-1] array of strides for local data
* @param[in] alpha multiplier for data before adding to existing results
* @param[out] nbhandle nonblocking handle
*/
void nbAcc(int lo[], int hi[], void *buf, int ld[], void *alpha,
GANbhdl *nbhandle);
/**
* @copydoc GlobalArray::nbAcc(int[],int[],void*,int[],void*,GANbhdl*)
*/
void nbAcc(int64_t lo[], int64_t hi[], void *buf, int64_t ld[], void *alpha,
GANbhdl *nbhandle);
/**
* Non-blocking get operation. This is function gets a data block from a
* global array, copies it into a local buffer, and returns a nonblocking
* handle. Completion of the operation can be forced by calling the nbwait
* method on the handle.
*
* This is a onesided operation.
*
* @param[in] lo [ndim] patch coordinates of block
* @param[in] hi [ndim] patch coordinates of block
* @param[in] buf local buffer to receive data
* @param[in] ld [ndim-1] array of strides for local data
* @param[out] nbhandle nonblocking handle
*/
void nbGet(int lo[], int hi[], void *buf, int ld[], GANbhdl *nbhandle);
/**
* @copydoc GlobalArray::nbGet(int[],int[],void*,int[],GANbhdl*)
*/
void nbGet(int64_t lo[], int64_t hi[], void *buf, int64_t ld[], GANbhdl *nbhandle);
/**
* Non-blocking update operation for arrays with ghost cells. Ghost cells
* along the coordinates specified in the mask array are updated with
* non-blocking get calls. The mask array must contain either 0's or 1's.
*
* This is a onesided operation.
*
* @param[in] mask [ndim] array with flags for directions that are
* to be updated
* @param[out] nbhandle nonblocking handle
*/
void nbGetGhostDir(int mask[], GANbhdl *nbhandle);
/**
* @copydoc GlobalArray::nbGetGhostDir(int[],GANbhdl*)
*/
void nbGetGhostDir(int64_t mask[], GANbhdl *nbhandle);
/**
* Given a distribution of an array represented by the handle g_a,
* returns the number of partitions of each array dimension.
*
* This operation is local.
*
* @param[out] nblock [ndim] number of partitions for each dimension
*/
void nblock(int nblock[]) const;
/**
* Non-blocking put operation. This is function puts a data block from a
* local array, copies it into a global array, and returns a nonblocking
* handle. Completion of the operation can be forced by calling the nbwait
* method on the handle.
*
* This is a onesided operation.
*
* @param[in] lo [ndim] patch coordinates of block
* @param[in] hi [ndim] patch coordinates of block
* @param[in] buf local buffer that supplies data
* @param[in] ld [ndim-1] array of strides for local data
* @param[out] nbhandle nonblocking handle
*/
void nbPut(int lo[], int hi[], void *buf, int ld[], GANbhdl *nbhandle);
/**
* @copydoc GlobalArray::nbPut(int[],int[],void*,int[],GANbhdl*)
*/
void nbPut(int64_t lo[], int64_t hi[], void *buf, int64_t ld[], GANbhdl *nbhandle);
/**
* Returns the number of dimensions in this GlobalArray.
*
* This operation is local.
*
* @return number of dimensions aka rank
*/
int ndim() const;
/**
* The pack subroutine is designed to compress the values in the source vector
* g_src into a smaller destination array g_dest based on the values in an
* integer mask array g_mask. The values lo and hi denote the range of
* elements that should be compressed and icount is a variable that on output
* lists the number of values placed in the compressed array. This operation
* is the complement of the ga_unpack operation. An example is shown below
*
* g_src->pack(g_dest, g_mask, 1, n, icount)
* g_mask: 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0
* g_src: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
* g_dest: 1 7 9 12 15 16
* icount: 6
*
* The calling array is the source array.
*
* This is a collective operation.
*
* @param[out] g_dest destination array
* @param[in] g_mask mask array
* @param[in] lo coordinate interval to pack
* @param[in] hi coordinate interval to pack
* @param[out] icount number of packed elements
*/
void pack(const GlobalArray *g_dest, const GlobalArray *g_mask,
int lo, int hi, int *icount) const;
/**
* @copydoc GlobalArray::pack(const GlobalArray*,const GlobalArray*,int,int,int*)const
*/
void pack(const GlobalArray *g_dest, const GlobalArray *g_mask,
int64_t lo, int64_t hi, int64_t *icount) const;
/**
* This subroutine enumerates the values of an array between elements lo and
* hi starting with the value istart and incrementing each subsequent value by
* inc. This operation is only applicable to 1-dimensional arrays. An example
* of its use is shown below:
*
* call g_a->patch_enum(g_a, 1, n, 7, 2)
* g_a: 7 9 11 13 15 17 19 21 23 ...
*
* This is a collective operation.
*
* @param[in] lo coordinate interval to enumerate
* @param[in] hi coordinate interval to enumerate
* @param[in] istart starting value of enumeration
* @param[in] inc increment value
*/
void patchEnum(int lo, int hi, void *istart, void *inc);
/**
* @copydoc GlobalArray::patchEnum(int,int,int,int)
*/
void patchEnum(int64_t lo, int64_t hi, void *start, void *inc);
/**
* Same as nga_acc except the indices can extend beyond the array
* boundary/dimensions in which case the library wraps them around.
*
* This is a one-sided and atomic operation.
*
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
* @param[in] buf pointer to the local buffer array
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
* @param[in] alpha double/DoubleComplex/long scale factor
*/
void periodicAcc(int lo[], int hi[], void* buf, int ld[], void* alpha) const;
/**
* @copydoc GlobalArray::periodicAcc(int[],int[],void*,int[],void*)const
*/
void periodicAcc(int64_t lo[], int64_t hi[], void* buf, int64_t ld[], void* alpha) const;
/**
* Same as nga_get except the indices can extend beyond the array
* boundary/dimensions in which case the library wraps them around.
*
* This is a one-sided operation.
*
* @param[in] lo [ndim] array of starting indices for global array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[out] buf pointer to the local buffer array where the data goes
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
*/
void periodicGet(int lo[], int hi[], void* buf, int ld[]) const;
/**
* @copydoc GlobalArray::periodicGet(int[],int[],void*,int[])const
*/
void periodicGet(int64_t lo[], int64_t hi[], void* buf, int64_t ld[]) const;
/**
* Same as nga_put except the indices can extend beyond the array
* boundary/dimensions in which case the library wraps them around.
*
* This is a one-sided operation.
*
* @param[in] lo [ndim] array of starting indices for global array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[in] buf pointer to the local buffer array where the data goes
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
*/
void periodicPut(int lo[], int hi[], void* buf, int ld[]) const;
/**
* @copydoc GlobalArray::periodicPut(int[],int[],void*,int[])const
*/
void periodicPut(int64_t lo[], int64_t hi[], void* buf, int64_t ld[]) const;
/**
* Prints an entire array to the standard output.
*
* This is a collective operation.
*/
void print() const ;
/**
* Prints the array distribution.
*
* This is a collective operation.
*/
void printDistribution() const ;
/**
* Prints the array distribution to a file.
*
* This is a collective operation.
*/
void printFile(FILE *file) const;
/**
* Prints a patch of g_a array to the standard output. If pretty has the
* value 0 then output is printed in a dense fashion. If pretty has the
* value 1 then output is formatted and rows/columns labeled.
* This is a collective operation.
*
* @param[in] lo coordinates of the patch
* @param[in] hi coordinates of the patch
* @param[in] pretty formatting flag
*/
void printPatch(int* lo, int* hi, int pretty) const;
/**
* @copydoc GlobalArray::printPatch(int*,int*,int)const
*/
void printPatch(int64_t* lo, int64_t* hi, int pretty) const;
/**
* Based on the distribution of an array associated with handle g_a,
* determines coordinates of the specified processor in the virtual
* processor grid corresponding to the distribution of array g_a. The
* numbering starts from 0. The values of -1 means that the processor
* doesn't 'own' any section of array represented by g_a.
*
* This operation is local.
*
* @param[in] proc process id
* @param[out] coord [ndim] coordinates in processor grid
*
*/
void procTopology(int proc, int coord[]) const;
/*void procTopology(int proc, int *prow, int *pcol);*/
/**
* Copies data from local array buffer to the global array section . The
* local array is assumed to be have the same number of dimensions as the
* global array. Any detected inconsitencies/errors in input arguments are
* fatal. This is a one-sided operation.
*
* @param[in] lo [ndim] array of starting indices for global array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[in] buf pointer to the local buffer array where the data is
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
* @param[in] buf buffer array
*/
void put(int lo[], int hi[], void *buf, int ld[]) const;
/**
* @copydoc GlobalArray::put(int[],int[],void*,int[])const
*/
void put(int64_t lo[], int64_t hi[], void *buf, int64_t ld[]) const;
/**
* Atomically read and increment an element in an integer array.
*
* *BEGIN CRITICAL SECTION*
*
* old_value = a(subscript)
*
* a(subscript) += inc
*
* *END CRITICAL SECTION*
*
* return old_value
*
* This is a one-sided and atomic operation.
*
* @param[in] subscript [ndim] subscript array for the referenced element
* @param[in] inc how much to increment by
* @return the incremented value
*/
long readInc(int subscript[], long inc) const;
/**
* @copydoc GlobalArray::readInc(int[],long)const
*/
long readInc(int64_t subscript[], long inc) const;
/**
* Releases access to a global array when the data was read only.
* Your code should look like:
*
* @code
* g_a->distribution(myproc, lo,hi);
* g_a->access(lo, hi, &ptr, ld);
* // <operate on the data referenced by ptr>
* g_a->release(lo, hi);
* @endcode
*
* @note see restrictions specified for ga_access.
*
* This operation is local.
*
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
*/
void release(int lo[], int hi[]) const;
/**
* @copydoc GlobalArray::release(int[],int[])const
*/
void release(int64_t lo[], int64_t hi[]) const;
/**
* Releases access to the block of data specified by the integer
* index when data was accessed as read only. This is only applicable to
* block-cyclic data distributions created using the simple block-cyclic
* distribution.
*
* This is a local operation.
*
* @param[in] index block index
*/
void releaseBlock(int index) const;
/**
* Releases access to the block of data specified by the subscript
* array when data was accessed as read only. This is only applicable to
* block-cyclic data distributions created using the SCALAPACK data
* distribution.
*
* This is a local operation.
*
* @param[in] index [ndim] indices of block in array
*/
void releaseBlockGrid(int index[]) const;
/**
* Releases access to the block of locally held data for a block-cyclic
* array, when data was accessed as read-only. This is a local operation.
*
* @param[in] proc process ID/rank
*/
void releaseBlockSegment(int proc) const;
/**
* Releases access to the data. It must be used if the data was accessed
* for writing. NOTE: see restrictions specified for ga_access.
*
* This operation is local.
*
* @param[in] lo [ndim] array of starting indices for array section
* @param[in] hi [ndim] array of ending indices for array section
*/
void releaseUpdate(int lo[], int hi[]) const;
/**
* @copydoc GlobalArray::releaseUpdate(int[],int[])const
*/
void releaseUpdate(int64_t lo[], int64_t hi[]) const;
/**
* Releases access to the block of data specified by the integer index when
* data was accessed in read-write mode. This is only applicable to
* block-cyclic data distributions created using the simple block-cyclic
* distribution.
*
* This is a local operation.
*
* @param[in] index block index
*/
void releaseUpdateBlock(int index) const;
/**
* Releases access to the block of data specified by the subscript
* array when data was accessed in read-write mode. This is only applicable
* to block-cyclic data distributions created using the SCALAPACK data
* distribution.
*
* This is a local operation.
*
* @param[in] index [ndim] indices of block in array
*/
void releaseUpdateBlockGrid(int index[]) const;
/**
* Releases access to the block of locally held data for a block-cyclic
* array, when data was accessed in read-write mode.
*
* This is a local operation.
*
* @param[in] proc process ID/rank
*/
void releaseUpdateBlockSegment(int proc) const;
/**
* Releases access to a global array containing ghost cells when the data was
* read only.
* Your code should look like:
*
* @code
* g_a->accessGhosts(dims, &ptr, ld)
* // <operate on the data referenced by ptr>
* g_a->releasGhosts();
* @endcode
*
* This operation is local.
*
*/
void releaseGhosts() const;
/**
* Releases access to a global array containing ghost cells when the data was
* accessed in read-write mode.
*
* This operation is local.
*
*/
void releaseUpdateGhosts() const;
/**
* Releases access to a global array containing ghost cells when the data was
* read only.
* Your code should look like:
*
* @code
* g_a->accessGhostElement(&ptr, subscript, ld)
* // <operate on the data referenced by ptr>
* g_a->releaseGhostElement(subscript);
* @endcode
*
* This operation is local.
* @param[in] indices of element
*
*/
void releaseGhostElement(int subscript[]) const;
/**
* @copydoc GlobalArray::releaseGhostElement(int subscript[]) const
*/
void releaseGhostElement(int64_t subscript[]) const;
/**
* Releases access to a global array containing ghost cells when the data was
* accessed in read-write mode.
*
* This operation is local.
* @param[in] indices of element
*
*/
void releaseUpdateGhostElement(int subscript[]) const;
/**
* @copydoc GlobalArray::releaseUpdateGhostElement(int subscript[]) const
*/
void releaseUpdateGhostElement(int64_t subscript[]) const;
/**
* Scales an array by the constant s. Note that the library is unable
* to detect errors when the pointed value is of different type than
* the array.
*
* This is a collective operation.
*
* @param[in] value pointer to the value of appropriate type
*/
void scale(void *value) const;
/**
* Scale an array by the factor 'val'.
*
* This is a collective operation.
*
* @param[in] lo patch of g_a
* @param[in] hi patch of g_a
* @param[in] val scale factor
*/
void scalePatch (int lo[], int hi[], void *val) const;
/**
* @copydoc GlobalArray::scalePatch(int[],int[],void*)const
*/
void scalePatch (int64_t lo[], int64_t hi[], void *val) const;
/**
* This operation will add successive elements in a source vector g_src
* and put the results in a destination vector g_dest. The addition will
* restart based on the values of the integer mask vector g_mask. The scan
* is performed within the range specified by the integer values lo and
* hi. Note that this operation can only be applied to 1-dimensional
* arrays. The excl flag determines whether the sum starts with the value
* in the source vector corresponding to the location of a 1 in the mask
* vector (excl=0) or whether the first value is set equal to 0
* (excl=1). Some examples of this operation are given below.
*
* g_src->scanAdd(g_dest, g_mask, 1, n, 0);
* g_mask: 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0
* g_src: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
* g_dest: 1 3 6 10 16 21 7 15 9 19 30 12 25 39 15 16 33
*
* g_src->scanAdd(g_dest, g_mask, 1, n, 1);
* g_mask: 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0
* g_src: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
* g_dest: 0 1 3 6 10 15 0 7 0 9 19 0 12 25 0 0 16
*
* This is a collective operation.
*
* @param[out] g_dest handle for destination array
* @param[in] g_mask handle for integer array representing mask
* @param[in] lo low and high values of range on which operation
* is performed
* @param[in] hi low and high values of range on which operation
* is performed
* @param[in] excl value to signify if masked values are included in in add
*/
void scanAdd(const GlobalArray *g_dest, const GlobalArray *g_mask,
int lo, int hi, int excl) const;
/**
* @copydoc GlobalArray::scanAdd(const GlobalArray*,const GlobalArray*,int,int,int)const
*/
void scanAdd(const GlobalArray *g_dest, const GlobalArray *g_mask,
int64_t lo, int64_t hi, int excl) const;
/**
* This subroutine does a segmented scan-copy of values in the
* source array g_src into a destination array g_dest with segments
* defined by values in the integer mask array g_mask. The scan-copy
* operation is only applied to the range between the lo and hi
* indices. This operation is restriced to 1-dimensional arrays. The
* resulting destination array will consist of segments of consecutive
* elements with the same value. An example is shown below
*
* g_src->scanCopy(g_dest, g_mask, 1, n);
* g_mask: 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0
* g_src: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
* g_dest: 1 1 1 1 1 1 7 7 9 9 9 12 12 12 15 16 16
*
* This is a collective operation.
*
* @param[out] g_dest handle for destination array
* @param[in] g_mask handle for integer array representing mask
* @param[in] lo low and high values of range on which operation
* is performed
* @param[in] hi low and high values of range on which operation
* is performed
*/
void scanCopy(const GlobalArray *g_dest, const GlobalArray *g_mask,
int lo, int hi) const;
/**
* @copydoc GlobalArray::scanCopy(const GlobalArray*,const GlobalArray*,int,int)const
*/
void scanCopy(const GlobalArray *g_dest, const GlobalArray *g_mask,
int64_t lo, int64_t hi) const;
/**
* Scatters array elements into a global array. The contents of the input
* arrays (v,subscrArray) are preserved, but their contents might be
* (consistently) shuffled on return.
*
* @code
* for(k=0; k<= n; k++) {
* a[subsArray[k][0]][subsArray[k][1]][subsArray[k][2]]... = v[k];
* }
* @endcode
*
* This is a one-sided operation.
*
* @param[in] n number of elements
* @param[in] v [n] array containing values
* @param[in] subsarray [n][ndim] array of subscripts for each element
*/
void scatter(void *v, int *subsarray[], int n) const;
/**
* @copydoc GlobalArray::scatter(void*,int*[],int)const
*/
void scatter(void *v, int64_t *subsarray[], int64_t n) const;
/**
* Adds element a local array to array elements into a global array after
* multiplying by alpha. The contents of the input arrays (v,subscrArray)
* are preserved, but their contents might be (consistently) shuffled on
* return.
*
* @code
* for(k=0; k<= n; k++) {
* a[subsArray[k][0]][subsArray[k][1]][subsArray[k][2]]... = v[k];
* }
* @endcode
*
* This is a one-sided operation.
*
* @param[in] n number of elements
* @param[in] v [n] array containing values
* @param[in] subsarray [n][ndim] array of subscripts for each element
* @param[in] alpha scale factor
*/
void scatterAcc(void *v, int *subsarray[], int n, void *alpha) const;
/**
* @copydoc GlobalArray::scatterAcc(void*,int*[],int,void*)const
*/
void scatterAcc(void *v, int64_t *subsarray[], int64_t n, void *alpha) const;
/**
* Returns the value and index for an element that is selected by the
* specified operator in a global array corresponding to g_a handle.
*
* This is a collective operation.
*
* @param[in] op operator {"min","max"}
* @param[out] val address where value should be stored
* @param[out] index [ndim] array index for the selected element
*/
void selectElem(char *op, void* val, int index[]) const;
/**
* @copydoc GlobalArray::selectElem(char*,void*,int[])const
*/
void selectElem(char *op, void* val, int64_t index[]) const;
/**
* This function can be used to assign a unique character
* string name to a global array handle that was obtained
* using the createHandle function.
*
* This is a collective operation.
*
* @param[in] name array name
*/
void setArrayName(char *name) const;
/**
* This subroutine is used to create a global array with a simple
* block-cyclic data distribution. The array is broken up into blocks of
* size dims and each block is numbered sequentially using a column major
* indexing scheme. The blocks are then assigned in a simple round-robin
* fashion to processors. This is illustrated in the figure below for an
* array containing 25 blocks distributed on 4 processors. Blocks at the
* edge of the array may be smaller than the block size specified in
* dims. In the example below, blocks 4,9,14,19,20,21,22,23, and 24 might
* be smaller thatn the remaining blocks. Most global array operations
* are insensitive to whether or not a block-cyclic data distribution is
* used, although performance may be slower in some cases if the global
* array is using a block-cyclic data distribution. Individual data
* blocks can be accessesed using the block-cyclic access functions.
*
* This is a collective operation.
*
* @param[in] dims array of block dimensions
*/
void setBlockCyclic(int dims[]) const;
/**
* This subroutine is used to create a global array with a
* SCALAPACK-type block cyclic data distribution. The user specifies
* the dimensions of the processor grid in the array proc_grid. The
* product of the processor grid dimensions must equal the number of
* total number of processors and the number of dimensions in the
* processor grid must be the same as the number of dimensions in the
* global array. The data blocks are mapped onto the processor grid
* in a cyclic manner along each of the processor grid axes. This is
* illustrated below for an array consisting of 25 data blocks
* disributed on 6 processors. The 6 processors are configured in a 3
* by 2 processor grid. Blocks at the edge of the array may be
* smaller than the block size specified in dims. Most global array
* operations are insensitive to whether or not a block-cyclic data
* distribution is used, although performance may be slower in some
* cases if the global array is using a block-cyclic data
* distribution. Individual data blocks can be accessesed using the
* block-cyclic access functions.
*
* This is a collective operation.
*
* @param[in] dims array of block dimensions
* @param[in] proc_grid processor grid dimensions
*/
void setBlockCyclicProcGrid(int dims[], int proc_grid[]) const;
/**
* This function is used to set the chunk array for a global array handle
* that was obtained using the createHandle function. The chunk array
* is used to determine the minimum number of array elements assigned to
* each processor along each coordinate direction.
*
* This is a collective operation.
*
* @param[in] chunk array of chunk widths
*/
void setChunk(int chunk[]) const;
/**
* @copydoc GlobalArray::setChunk(int[])const
*/
void setChunk(int64_t chunk[]) const;
/**
* This function can be used to set the array dimension, the coordinate
* dimensions, and the data type assigned to a global array handle obtained
* using the GA_Create_handle function.
*
* This is a collective operation.
*
* @param[in] ndim dimension of global array
* @param[in] dims dimensions of global array
* @param[in] type data type of global array
*/
void setData(int ndim, int dims[], int type) const;
/**
* @copydoc GlobalArray::setData(int,int[],int)const
*/
void setData(int ndim, int64_t dims[], int type) const;
/**
* This function can be used to set the ghost cell widths for a global
* array handle that was obtained using the createHandle function. The
* ghosts cells widths indicate how many ghost cells are used to pad the
* locally held array data along each dimension. The padding can be set
* independently for each coordinate dimension.
*
* This is a collective operation.
*
* @param[in] width [ndim] array of ghost cell widths
*/
void setGhosts(int width[]) const;
/**
* @copydoc GlobalArray::setGhosts(int[])const
*/
void setGhosts(int64_t width[]) const;
/**
* This function can be used to partition the array data among the
* individual processors for a global array handle obtained using the
* GA_Create_handle function.
*
* The distribution is specified as a Cartesian product of distributions
* for each dimension. For example, the following figure demonstrates
* distribution of a 2-dimensional array 8x10 on 6 (or more)
* processors. nblock(2)={3, 2}, the size of mapc array is s=5 and array
* mapc contains the following elements mapc={1, 3, 7, 1, 6}. The
* distribution is nonuniform because, P1 and P4 get 20 elements each and
* processors P0,P2,P3, and P5 only 10 elements each.
*
* The array width() is used to control the width of the ghost cell
* boundary around the visible data on each processor. The local data of
* the global array residing on each processor will have a layer width(n)
* ghosts cells wide on either side of the visible data along the dimension
* n.
*
* This is a collective operation.
*
* @param[in] mapc [s] starting index for each block; the size
* s is the sum of all elements of the array nblock
* @param[in] nblock [ndim] number of blocks that each dimension is
* divided into
*/
void setIrregDistr(int mapc[], int nblock[]) const;
/**
* @copydoc GlobalArray::setIrregDistr(int mapc[], int nblock[]) const
*/
void setIrregDistr(int64_t mapc[], int64_t nblock[]) const;
/**
* This function can be used to set the processor configuration assigned to
* a global array handle that was obtained using the
* createHandle function. It can be used to create mirrored arrays by
* using the mirrored array processor configuration in this function
* call. It can also be used to create an array on a processor group by
* using a processor group handle in this call.
*
* This is a collective operation.
*
* @param[in] pHandle processor group handle
*/
void setPGroup(PGroup *pHandle) const;
/**
* This function is used to restrict the number of processors in a global
* array that actually contain data. It can also be used to rearrange the
* layout of data on a processor from the default distribution. Only the
* processes listed in list[] will actually contain data, the remaining
* processes will be able to see the data in the global array but they will
* not contain any of the global array data locally.
*
* @param[in] list list of processors that should contain data
* @param[in] nprocs number of processors in list
*
*/
void setRestricted(int list[], int nprocs) const;
/**
* This function is used to restrict the number of processors in a global
* array that actually contain data. Only the processors in the range
* [lo_proc:hi_proc] (inclusive) will actually contain data, the remaining
* processes will be able to see the data in the global array but they will
* not contain any of the global array data locally.
*
* @param[in] lo_proc low end of processor range
* @param[in] hi_proc high end of processor range
*/
void setRestrictedRange(int lo_proc, int hi_proc) const;
/**
* Performs one of the matrix-matrix operations:
*
* C := alpha*op( A )*op( B ) + beta*C,
* where op( X ) is one of
* op( X ) = X or op( X ) = X',
* alpha and beta are scalars, and A, B and C are matrices, with op( A )
* an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.
* On entry, transa specifies the form of op( A ) to be used in the
* matrix multiplication as follows:
*
* ta = 'N' or 'n', op( A ) = A.
*
* ta = 'T' or 't', op( A ) = A'.
*
* This is a collective operation.
*
* @param[in] g_a handles to input arrays
* @param[in] g_b handles to input arrays
* @param[in] ta transpose operators
* @param[in] tb transpose operators
* @param[in] m number of rows of op(A) and of matrix C
* @param[in] n number of columns of op(B) and of matrix C
* @param[in] k number of columns of op(A) and rows of matrix op(B)
* @param[in] alpha scale factors
* @param[in] beta scale factors
*
*/
void sgemm(char ta, char tb, int m, int n, int k, float alpha,
const GlobalArray *g_a, const GlobalArray *g_b, float beta) const;
/**
* @copydoc GlobalArray::sgemm(char,char,int,int,int,float,const GlobalArray*,const GlobalArray*,float)const
*/
void sgemm(char ta, char tb, int64_t m, int64_t n, int64_t k, float alpha,
const GlobalArray *g_a, const GlobalArray *g_b, float beta) const;
/**
* Solves a system of linear equations
* A * X = B
* It first will call the Cholesky factorization routine and, if
* sucessfully, will solve the system with the Cholesky solver. If
* Cholesky will be not be able to factorize A, then it will call the
* LU factorization routine and will solve the system with forward/backward
* substitution. On exit B will contain the solution X.
*
* This is a collective operation.
*
* @param[in] g_a coefficient matrix
*
* @return = 0 : Cholesky factoriztion was succesful\n
* > 0 : the leading minor of this order
* is not positive definite, Cholesky factorization
* could not be completed and LU factoriztion was used
*/
int solve(const GlobalArray * g_a) const;
/**
* It computes the inverse of a double precision using the Cholesky
* factorization of a NxN double precision symmetric positive definite
* matrix A stored in the global array represented by g_a. On successful
* exit, A will contain the inverse.
*
* This is a collective operation.
*
* @return = 0 : successful exit\n
* > 0 : the leading minor of this order is not positive
* definite and the factorization could not be completed\n
* < 0 : it returns the index i of the (i,i)
* element of the factor L/U that is zero and
* the inverse could not be computed
*/
int spdInvert() const;
/**
* This operation is the same as "acc", except that the values
* corresponding to dimension n in buf are accumulated to every skip[n]
* values of the global array.
*
* This is a one-sided operation.
*
* @param[in] lo [ndim] array of starting indices for glob array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[in] skip [ndim] array of strides for each dimension
* @param[in] buf pointer to local buffer array where data goes
* @param[in] ld [ndim-1] rray specifying leading
* dimensions/strides/extents for buffer array
* @param[in] alpha double/DoublComplex/long scale factor
*/
void stridedAcc(int lo[], int hi[], int skip[], void*buf, int ld[], void *alpha) const;
/**
* @copydoc GlobalArray::stridedAcc(int[],int[],int[],void*,int[],void*)const
*/
void stridedAcc(int64_t lo[], int64_t hi[], int64_t skip[], void*buf, int64_t ld[], void *alpha) const;
/**
* This operation is the same as "get", except that the values
* corresponding to dimension n in buf are accumulated to every skip[n]
* values of the global array.
*
* This is a one-sided operation.
*
* @param[in] lo [ndim] array of starting indices for glob array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[in] skip [ndim] array of strides for each dimension
* @param[out] buf pointer to local buffer array where data goes
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
*/
void stridedGet(int lo[], int hi[], int skip[], void*buf, int ld[]) const;
/**
* @copydoc GlobalArray::stridedGet(int[],int[],int[],void*,int[])const
*/
void stridedGet(int64_t lo[], int64_t hi[], int64_t skip[], void*buf, int64_t ld[]) const;
/**
* This operation is the same as "put", except that the values
* corresponding to dimension n in buf are accumulated to every skip[n]
* values of the global array.
*
* This is a one-sided operation.
*
* @param[in] lo [ndim] array of starting indices for glob array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[in] skip [ndim] array of strides for each dimension
* @param[in] buf pointer to local buffer array where data goes
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
*/
void stridedPut(int lo[], int hi[], int skip[], void*buf, int ld[]) const;
/**
* "long" interface for stridedPut
*/
void stridedPut(int64_t lo[], int64_t hi[], int64_t skip[], void*buf, int64_t ld[]) const;
/**
* Prints info about allocated arrays.
*
* @param[in] verbose If true print distribution info
*/
void summarize(int verbose) const;
/**
* Symmmetrizes matrix A with handle A:=.5 * (A+A').
*
* This is a collective operation
*/
void symmetrize() const;
/**
* This function returns the total number of blocks contained in a global
* array with a block-cyclic data distribution.
*
* This is a local operation.
*
* @return number of blocks contained in this block-cyclic distribution
*/
int totalBlocks() const;
/**
* Transposes a matrix: B = A', where A and B are represented by
* handles g_a and g_b [say, g_b.transpose(g_a);].
*
* This is a collective operation.
*
* @param[in] g_a GlobalArray to transpose and assign to this GlobalArray
*/
void transpose(const GlobalArray * g_a) const;
/**
* The unpack subroutine is designed to expand the values in the source
* vector g_src into a larger destination array g_dest based on the values
* in an integer mask array g_mask. The values lo and hi denote the range
* of elements that should be compressed and icount is a variable that on
* output lists the number of values placed in the uncompressed array. This
* operation is the complement of the pack operation. An example is
* shown below
*
* g_src->unpack(g_dest, g_mask, 1, n, &icount);
* g_src: 1 7 9 12 15 16
* g_mask: 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0
* g_dest: 1 0 0 0 0 0 7 0 9 0 0 12 0 0 15 16 0
* icount: 6
*
* This is a collective operation.
*
* @param[out] g_dest handle for destination array
* @param[in] g_mask handle for integer array representing mask
* @param[in] lo low value of range on which operation is performed
* @param[in] hi high value of range on which operation is performed
* @param[out] icount number of values in uncompressed array
*/
void unpack(GlobalArray *g_dest, GlobalArray *g_mask, int lo, int hi,
int *icount) const;
/**
* @copydoc GlobalArray::unpack(GlobalArray*,GlobalArray*,int,int,int*)const
*/
void unpack(GlobalArray *g_dest, GlobalArray *g_mask,
int64_t lo, int64_t hi, int64_t *icount) const;
/**
* This call updates the ghost cell regions on each processor with the
* corresponding neighbor data from other processors. The operation assumes
* that all data is wrapped around using periodic boundary data so that
* ghost cell data that goes beyound an array boundary is wrapped around to
* the other end of the array. The updateGhosts call contains two
* sync calls before and after the actual update operation. For some
* applications these calls may be unecessary, if so they can be removed
* using the maskSync subroutine.
*
* This is a collective operation.
*/
void updateGhosts() const;
/**
* This operation is similar to the standard updateGhosts operation except
* that it returns a non-blocking handle after initiating the call. Completion
* of the operation can be guaranteed by call call the NbWait function on the
* handle. Data in the local buffers is then ready for use.
*
* This is a collective operation.
*/
void updateGhostsNb(GANbhdl *nbhandle) const;
/**
* This function can be used to update the ghost cells along individual
* directions. It is designed for algorithms that can overlap updates
* with computation. The variable dimension indicates which coordinate
* direction is to be updated (e.g. dimension = 1 would correspond to the
* y axis in a two or three dimensional system), the variable idir can take
* the values +/-1 and indicates whether the side that is to be updated lies
* in the positive or negative direction, and cflag indicates whether or not
* the corners on the side being updated are to be included in the update.
* The following calls would be equivalent to a call to updateGhosts
* for a 2-dimensional system:
*
* status = g_a->updateGhostDir(0,-1,1);\n
* status = g_a->updateGhostDir(0,1,1);\n
* status = g_a->updateGhostDir(1,-1,0);\n
* status = g_a->updateGhostDir(1,1,0);\n
*
* The variable cflag is set equal to 1 (or non-zero) in the first two
* calls so that the corner ghost cells are update, it is set equal to 0 in
* the second two calls to avoid redundant updates of the corners. Note
* that updating the ghosts cells using several independent calls to the
* nga_update_ghost_dir functions is generally not as efficient as using
* updateGhosts unless the individual calls can be effectively overlapped
* with computation.
*
* This is a collective operation.
*
* @param[in] dimension array dimension that is to be updated
* @param[in] idir direction of update (+/- 1)
* @param[in] cflag flag (0/1) to include corners in update
*/
int updateGhostDir(int dimension, int idir, int cflag) const;
/**
* This operation is designed to extract ghost cell data from a global array
* and copy it to a local array. If the request can be satisfied using
* completely local data, then a local copy will be used. Otherwise, the
* method calls periodicGet. The request can be satisfied locally if
* lo is greater than or equal to the lower bound of data held on the
* processor minus the ghost cell width and hi is less than or equal to the
* upper bound of data held on the processor plus the ghost cell width. Cell
* indices using the global address space should be used for lo and hi. These
* may exceed the global array dimensions.
*
* @param[in] lo [ndim] array of starting indices for global array section
* @param[in] hi [ndim] array of ending indices for global array section
* @param[out] buf pointer to the local buffer array where the data goes
* @param[in] ld [ndim-1] array specifying leading
* dimensions/strides/extents for buffer array
*/
void getGhostBlock(int lo[], int hi[], void *buf, int ld[]) const;
/**
* @copydoc GlobalArray::getGhostBlock(int[],int[],void*,int[])const
*/
void getGhostBlock(int64_t lo[], int64_t hi[], void *buf, int64_t ld[]) const;
/**
* Computes element-wise dot product of the two arrays which must be of
* the same types and same number of elements.
*
* This is a collective operation.
*
* @param[in] g_a array handle
*
* @return value = SUM_ij a(i,j)*b(i,j)
*/
DoubleComplex zdot(const GlobalArray * g_a) const;
/**
* Computes the element-wise dot product of the two (possibly transposed)
* patches which must be of the same type and have the same number of
* elements.
*
* @param[in] ta transpose flags
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] g_a global array
* @param[in] tb transpose flags
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
* @return value
*/
DoubleComplex zdotPatch(char ta, int alo[], int ahi[],
const GlobalArray * g_a, char tb, int blo[],
int bhi[]) const;
/**
* @copydoc GlobalArray::zdotPatch(char,int[],int[],const GlobalArray*,char,int[],int[])const
*/
DoubleComplex zdotPatch(char ta, int64_t alo[], int64_t ahi[],
const GlobalArray * g_a, char tb, int64_t blo[],
int64_t bhi[]) const;
/**
* Sets value of all elements in the array to zero.
*
* This is a collective operation.
*/
void zero() const;
/**
* Set all the elements in the patch to zero.
* This is a collective operation.
*
* @param[in] lo
* @param[in] hi
*/
void zeroPatch (int lo[], int hi[]) const;
/**
* @copydoc GlobalArray::zeroPatch(int[],int[])const
*/
void zeroPatch (int64_t lo[], int64_t hi[]) const;
/**
* Performs one of the matrix-matrix operations:
* C := alpha*op( A )*op( B ) + beta*C,
* where op( X ) is one of
* op( X ) = X or op( X ) = X',
* alpha and beta are scalars, and A, B and C are matrices, with op( A )
* an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.
* On entry, transa specifies the form of op( A ) to be used in the
* matrix multiplication as follows:
*
* ta = 'N' or 'n', op( A ) = A.
*
* ta = 'T' or 't', op( A ) = A'. *
*
* This is a collective operation.
*
* @param[in] g_a handles to input arrays
* @param[in] g_b handles to input arrays
* @param[in] ta transpose operators
* @param[in] tb transpose operators
* @param[in] m number of rows of op(A) and of matrix C
* @param[in] n number of columns of op(B) and of matrix C
* @param[in] k number of columns of op(A) and rows of matrix op(B)
* @param[in] alpha scale factors
* @param[in] beta scale factors
*/
void zgemm(char ta, char tb, int m, int n, int k, DoubleComplex alpha,
const GlobalArray *g_a, const GlobalArray *g_b,
DoubleComplex beta) const;
/**
* @copydoc GlobalArray::zgemm(char,char,int,int,int,DoubleComplex,const GlobalArray*,const GlobalArray*,DoubleComplex)const
*/
void zgemm(char ta, char tb, int64_t m, int64_t n, int64_t k, DoubleComplex alpha,
const GlobalArray *g_a, const GlobalArray *g_b,
DoubleComplex beta) const;
/* New additional functionalities from Limin. */
/**
* Take element-wise absolute value of the array.
*
* This is a collective operation.
*/
void absValue() const;
/**
* Take element-wise absolute value of the patch.
*
* This is a collective operation.
*
* @param[in] lo patch coordinates
* @param[in] hi patch coordinates
*/
void absValuePatch(int *lo, int *hi) const;
/**
* @copydoc GlobalArray::absValuePatch(int*,int*)const
*/
void absValuePatch(int64_t *lo, int64_t *hi) const;
/**
* Add the constant pointed by alpha to each element of the array.
*
* This is a collective operation.
*
* @param[in] alpha double/complex/int/long/float
*/
void addConstant(void* alpha) const;
/**
* Add the constant pointed by alpha to each element of the patch.
*
* This is a collective operation.
*
* @param[in] lo g_a patch coordinates
* @param[in] hi g_a patch coordinates
* @param[in] alpha double/complex/int/long/float
*/
void addConstantPatch(int *lo, int *hi, void *alpha) const;
/**
* @copydoc GlobalArray::addConstantPatch(int*,int*,void*)const
*/
void addConstantPatch(int64_t *lo, int64_t *hi, void *alpha) const;
/**
* Take element-wise reciprocal of the array.
*
* This is a collective operation.
*/
void recip() const;
/**
* Take element-wise reciprocal of the patch.
*
* This is a collective operation.
*
* @param[in] lo patch coordinates
* @param[in] hi patch coordinates
*/
void recipPatch(int *lo, int *hi) const;
/**
* @copydoc GlobalArray::recipPatch(int*,int*)const
*/
void recipPatch(int64_t *lo, int64_t *hi) const;
/**
* Computes the element-wise product of the two arrays
* which must be of the same types and same number of
* elements. For two-dimensional arrays,
*
* c(i, j) = a(i,j)*b(i,j)
*
* The result (c) may replace one of the input arrays (a/b).
* This is a collective operation.
*
* @param[in] g_a GlobalArray
* @param[in] g_b GlobalArray
*/
void elemMultiply(const GlobalArray * g_a, const GlobalArray * g_b) const;
/**
* Computes the element-wise product of the two patches
* which must be of the same types and same number of
* elements. For two-dimensional arrays,
*
* c(i, j) = a(i,j)*b(i,j)
*
* The result (c) may replace one of the input arrays (a/b).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
* @param[in] clo g_c patch coordinates
* @param[in] chi g_c patch coordinates
*/
void elemMultiplyPatch(const GlobalArray * g_a,int *alo,int *ahi,
const GlobalArray * g_b,int *blo,int *bhi,
int *clo,int *chi) const;
/**
* @copydoc GlobalArray::elemMultiplyPatch(const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,int*,int*)const
*/
void elemMultiplyPatch(const GlobalArray * g_a,int64_t *alo,int64_t *ahi,
const GlobalArray * g_b,int64_t *blo,int64_t *bhi,
int64_t *clo,int64_t *chi) const;
/**
* Computes the element-wise quotient of the two arrays
* which must be of the same types and same number of
* elements. For two-dimensional arrays,
*
* c(i, j) = a(i,j)/b(i,j)
*
* The result (c) may replace one of the input arrays (a/b). If one of
* the elements of array g_b is zero, the quotient for the element of g_c
* will be set to GA_NEGATIVE_INFINITY.
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
*/
void elemDivide(const GlobalArray * g_a, const GlobalArray * g_b) const;
/**
* Computes the element-wise quotient of the two patches
* which must be of the same types and same number of
* elements. For two-dimensional arrays,
*
* c(i, j) = a(i,j)/b(i,j)
*
* The result (c) may replace one of the input arrays (a/b).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
* @param[in] clo g_c patch coordinates
* @param[in] chi g_c patch coordinates
*/
void elemDividePatch(const GlobalArray * g_a,int *alo,int *ahi,
const GlobalArray * g_b,int *blo,int *bhi,
int *clo,int *chi) const;
/**
* @copydoc GlobalArray::elemDividePatch(const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,int*,int*)const
*/
void elemDividePatch(const GlobalArray * g_a,int64_t *alo,int64_t *ahi,
const GlobalArray * g_b,int64_t *blo,int64_t *bhi,
int64_t *clo,int64_t *chi) const;
/**
* Computes the element-wise maximum of the two arrays
* which must be of the same types and same number of
* elements. For two dimensional arrays,
*
* c(i, j) = max{a(i,j), b(i,j)}
*
* The result (c) may replace one of the input arrays (a/b).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
*/
void elemMaximum(const GlobalArray * g_a, const GlobalArray * g_b) const;
/**
* Computes the element-wise maximum of the two patches
* which must be of the same types and same number of
* elements. For two-dimensional of noncomplex arrays,
*
* c(i, j) = max{a(i,j), b(i,j)}
*
* If the data type is complex, then
* c(i, j).real = max{ |a(i,j)|, |b(i,j)|} while c(i,j).image = 0.
*
* The result (c) may replace one of the input arrays (a/b).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
* @param[in] clo g_c patch coordinates
* @param[in] chi g_c patch coordinates
*/
void elemMaximumPatch(const GlobalArray * g_a,int *alo,int *ahi,
const GlobalArray * g_b,int *blo,int *bhi,
int *clo,int *chi) const;
/**
* @copydoc GlobalArray::elemMaximumPatch(const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,int*,int*)const
*/
void elemMaximumPatch(const GlobalArray * g_a,int64_t *alo,int64_t *ahi,
const GlobalArray * g_b,int64_t *blo,int64_t *bhi,
int64_t *clo,int64_t *chi) const;
/**
* Computes the element-wise minimum of the two arrays
* which must be of the same types and same number of
* elements. For two dimensional arrays,
*
* c(i, j) = min{a(i,j), b(i,j)}
*
* The result (c) may replace one of the input arrays (a/b).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
*/
void elemMinimum(const GlobalArray * g_a, const GlobalArray * g_b) const;
/**
* Computes the element-wise minimum of the two patches
* which must be of the same types and same number of
* elements. For two-dimensional of noncomplex arrays,
*
* c(i, j) = min{a(i,j), b(i,j)}
*
* If the data type is complex, then
* c(i, j).real = min{ |a(i,j)|, |b(i,j)|} while c(i,j).image = 0.
*
* The result (c) may replace one of the input arrays (a/b).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
* @param[in] clo g_c patch coordinates
* @param[in] chi g_c patch coordinates
*/
void elemMinimumPatch(const GlobalArray * g_a,int *alo,int *ahi,
const GlobalArray * g_b,int *blo,int *bhi,
int *clo,int *chi) const;
/**
* @copydoc GlobalArray::elemMinimumPatch(const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,int*,int*)const
*/
void elemMinimumPatch(const GlobalArray * g_a, int64_t *alo, int64_t *ahi,
const GlobalArray * g_b, int64_t *blo, int64_t *bhi,
int64_t *clo, int64_t *chi) const;
/**
* Calculates the largest multiple of a vector g_b that can be added
* to this vector g_a while keeping each element of this vector
* nonnegative.
*
* This is a collective operation.
*
* @param[in] g_b global array where g_b is the step direction.
* @param[out] step the maximum step
*/
void stepMax(const GlobalArray * g_b, double *step) const;
/**
* @copydoc GlobalArray::stepMax(const GlobalArray*,double*)const
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
*/
void stepMaxPatch(int *alo, int *ahi,
const GlobalArray * g_b, int *blo, int *bhi,
double *step) const;
/**
* @copydoc GlobalArray::stepMaxPatch(int*,int*,const GlobalArray*,int*,int*,double*)const
*/
void stepMaxPatch(int64_t *alo, int64_t *ahi,
const GlobalArray * g_b, int64_t *blo, int64_t *bhi,
double *step) const;
/** Matrix Operations */
/**
* Adds this constant to the diagonal elements of the matrix.
*
* This is a collective operation.
*
* @param[in] c double/complex/int/long/float constant to add
*/
void shiftDiagonal(void *c) const;
/**
* Sets the diagonal elements of this matrix g_a with the elements of the
* vector g_v.
*
* This is a collective operation.
*
* @param[in] g_v global array
*/
void setDiagonal(const GlobalArray * g_v) const;
/**
* Sets the diagonal elements of this matrix g_a with zeros.
*
* This is a collective operation.
*/
void zeroDiagonal() const;
/**
* Adds the elements of the vector g_v to the diagonal of this matrix g_a.
*
* This is a collective operation.
*
* @param[in] g_v global array
*/
void addDiagonal(const GlobalArray * g_v) const;
/**
* Inserts the diagonal elements of this matrix g_a into the vector g_v.
*
* This is a collective operation.
*
* @param[in] g_a global array
*/
void getDiagonal(const GlobalArray * g_a) const;
/**
* Scales the rows of this matrix g_a using the vector g_v.
*
* This is a collective operation.
*
* @param[in] g_v global array
*/
void scaleRows(const GlobalArray * g_v) const;
/**
* Scales the columns of this matrix g_a using the vector g_v.
*
* This is a collective operation.
*
* @param[in] g_v global array
*/
void scaleCols(const GlobalArray * g_v) const;
/**
* Computes the 1-norm of the matrix or vector g_a.
*
* This is a collective operation.
*
* @param[in] nm matrix/vector 1-norm value
*/
void norm1(double *nm) const;
/**
* Computes the 1-norm of the matrix or vector g_a.
*
* This is a collective operation.
*
* @param[in] nm - matrix/vector 1-norm value
*/
void normInfinity(double *nm) const;
/**
* Computes the componentwise Median of three arrays g_a, g_b, and g_c, and
* stores the result in this array g_m. The result (m) may replace one of
* the input arrays (a/b/c).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] g_c global array
*/
void median(const GlobalArray * g_a, const GlobalArray * g_b,
const GlobalArray * g_c) const;
/**
* Computes the componentwise Median of three patches g_a, g_b, and g_c, and
* stores the result in this patch g_m. The result (m) may replace one of
* the input patches (a/b/c).
*
* This is a collective operation.
*
* @param[in] g_a global array
* @param[in] g_b global array
* @param[in] g_c global array
* @param[in] alo g_a patch coordinates
* @param[in] ahi g_a patch coordinates
* @param[in] blo g_b patch coordinates
* @param[in] bhi g_b patch coordinates
* @param[in] clo g_c patch coordinates
* @param[in] chi g_c patch coordinates
* @param[in] mlo g_m patch coordinates
* @param[in] mhi g_m patch coordinates
*/
void medianPatch(const GlobalArray * g_a, int *alo, int *ahi,
const GlobalArray * g_b, int *blo, int *bhi,
const GlobalArray * g_c, int *clo, int *chi,
int *mlo, int *mhi) const;
/**
* @copydoc GlobalArray::medianPatch(const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,const GlobalArray*,int*,int*,int*,int*)const
*/
void medianPatch(const GlobalArray * g_a, int64_t *alo, int64_t *ahi,
const GlobalArray * g_b, int64_t *blo, int64_t *bhi,
const GlobalArray * g_c, int64_t *clo, int64_t *chi,
int64_t *mlo, int64_t *mhi) const;
GlobalArray& operator=(const GlobalArray &g_a);
int operator==(const GlobalArray &g_a) const;
int operator!=(const GlobalArray &g_a) const;
private:
int mHandle; /**<< g_a handle */
};
}
#endif /* _GLOBALARRAY_H */
|