-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathga_api.tex
More file actions
13164 lines (11082 loc) · 372 KB
/
ga_api.tex
File metadata and controls
13164 lines (11082 loc) · 372 KB
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
\documentclass[12pt]{article}
\include{preamble/preamble}
\begin{document}
\apih{ABS VALUE}{Converts a global array to contain absolute values of its elements}
\begin{capi}
\begin{ccode}
void GA_Abs_value(int g_a)
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine ga_abs_value(g_a)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::absValue() const
\end{cxxcode}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ga.abs_value(int g_a)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\end{funcargs}
\end{pyapi}
\gcoll
\begin{desc}
Take the element-wise absolute value of the array.
\end{desc}
\apih{ABS VALUE PATCH}{Converts a patch of a global array to have absolute values of its elements}
\begin{capi}
\begin{ccode}
void GA_Abs_value_patch(int g_a, int lo[], int hi[])
\end{ccode}
\begin{funcargs}
\inarg{}{g_a}{array handle}
\inarg{}{lo[], hi[]}{g_a patch coordinates}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine ga_abs_value_patch(g_a, lo, hi)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{lo(ndim), hi(ndim)}{g_a patch coordinates}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::absValuePatch(int *lo, int *hi) const
void GlobalArray::absValuePatch(int64_t *lo, int64_t *hi) const
\end{cxxcode}
\begin{funcargs}
\inarg{}{lo}{lower corner patch coordinates}
\inarg{}{hi}{upper corner patch coordinates}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ga.abs_value(int g_a, lo=None, hi=None)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{1D array-like}{lo}{lower bound patch coordinates, inclusive}
\inarg{1D array-like}{hi}{higher bound patch coordinates, exclusive}
\end{funcargs}
\end{pyapi}
\gcoll
\begin{desc}
Take the element-wise absolute value of the patch.
\end{desc}
\seealso{ABS VALUE}
\apih{ACC}{Accumulates data into a global array}
\begin{capi}
\begin{ccode}
void NGA_Acc(int g_a, int lo[], int hi[], void* buf, int ld[],
void* alpha)
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{global array handle}
\inarg{int}{ndim}{number of dimensions of the global array}
\inarg{int*}{lo[ndim]}{array of starting indices for array section}
\inarg{int*}{hi[ndim]}{array of ending indices for array section}
\inarg{void*}{buf}{pointer to the local buffer array}
\inarg{int*}{ld[ndim-1]}{array specifying leading dimensions/strides/extents for buffer array}
\inarg{double/double complex/long*}{alpha}{scale factor}
\end{funcargs}
\end{capi}
\begin{f2dapi}
\begin{fcode}
subroutine ga_acc(g_a, ilo, ihi, jlo, jhi, buf, ld, alpha)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{}
\inarg{integer}{ilo, ihi, jlo, jhi}{}
\inarg{double precision/complex}{buf}{local buffer containing data}
\inarg{integer}{ld}{}
\inarg{double precision/complex}{alpha}{scale argument for accumulate}
\end{funcargs}
\end{f2dapi}
\begin{fapi}
\begin{fcode}
subroutine nga_acc(g_a, lo, hi, buf, ld, alpha)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{global array handle}
\inarg{integer}{ndim}{number of dimensions of the global array}
\inarg{integer}{lo(ndim)}{array of starting indices for global array section}
\inarg{integer}{hi(ndim)}{array of ending indices for global array section}
\outarg{type}{buf}{local buffer containing data}
\inarg{integer}{ld(ndim-1)}{array specifying leading dimensions for buffer array}
\inarg{type}{alpha}{scale argument for accumulate}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::acc(int lo[], int hi[], void *buf,
int ld[], void *alpha) const
void GlobalArray::acc(int64_t lo[], int64_t hi[], void *buf,
int64_t ld[], void *alpha) const
\end{cxxcode}
\begin{funcargs}
\inarg{int*}{lo[ndim]}{array of starting indices for array section}
\inarg{int*}{hi[ndim]}{array of ending indices for array section}
\inarg{void*}{buf}{pointer to the local buffer array}
\inarg{int*}{ld[ndim-1]}{array specifying leading dimensions/strides/extents for buffer array}
\inarg{void*}{alpha}{scale factor (double/double complex/long *)}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ga.acc(int g_a, buffer, lo=None, hi=None, alpha=None)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{the array handle}
\inarg{array-like}{buffer}{the data to put}
\inarg{1D array-like of ints}{lo}{lower bound patch coordinates, inclusive}
\inarg{1D array-like of ints}{hi}{higher bound patch coordinates, exclusive}
\inarg{object}{alpha}{scale factor, cast to the appropriate type}
\end{funcargs}
\end{pyapi}
\ncoll
\begin{desc}
Combines data from local array buffer with data in the global array section.
The local array is assumed to be have the same number of dimensions as the
global array.
global array section (lo[],hi[]) += *alpha * buffer
\end{desc}
\apih{ACCESS}{Accesses data locally allocated for a global array}
\begin{capi}
\begin{ccode}
void NGA_Access(int g_a, int lo[], int hi[], void **ptr, int ld[])
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{global array handle}
\inarg{int}{ndim}{number of dimensions of the global array}
\inarg{int*}{lo[ndim]}{array of starting indices for array section}
\inarg{int*}{hi[ndim]}{array of ending indices for array section}
\outarg{void**}{ptr}{points to location of first element in patch}
\outarg{int*}{ld[ndim-1]}{leading dimensions for the patch elements}
\end{funcargs}
\end{capi}
\begin{f2dapi}
\begin{fcode}
subroutine ga_access(g_a, ilo, ihi, jlo, jhi, index, ld)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{}
\inarg{integer}{ilo, ihi, jlo, jhi}{}
\outarg{integer}{index}{}
\outarg{integer}{ld}{}
\end{funcargs}
\end{f2dapi}
\begin{fapi}
\begin{fcode}
subroutine nga_access(g_a, lo, hi, index, ld)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{ndim}{number of array dimensions}
\inarg{integer}{lo(ndim),hi(ndim)}{patch specification}
\outarg{integer}{index}{reference to local data}
\outarg{integer}{ld(ndim-1)}{array of leading dimensions}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::access(int lo[], int hi[], void **ptr, int ld[]) const
void GlobalArray::access(int64_t lo[], int64_t hi[], void *ptr, int64_t ld[]) cons
\end{cxxcode}
\begin{funcargs}
\inarg{int*}{lo[ndim]}{array of starting indices for array section}
\inarg{int*}{hi[ndim]}{array of ending indices for array section}
\outarg{void**}{ptr}{points to location of first element in patch}
\outarg{int*}{ld[ndim-1]}{leading dimensions for the patch elements}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ret = ga.access(int g_a, lo=None, hi=None)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{the array handle}
\inarg{1D array-like of ints}{lo}{lower bound patch coordinates, inclusive}
\inarg{1D array-like of ints}{hi}{higher bound patch coordinates, exclusive}
\end{funcargs}
\end{pyapi}
\local
\begin{cdesc}
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.
\end{cdesc}
\begin{cxxdesc}
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 access
normally follows a previous call to 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 distribution).
Each call to access has to be followed by a call to either release or
releaseUpdate. 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.
\end{cxxdesc}
\begin{pydesc}
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 access
normally follows a previous call to 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 distribution).
Each call to access has to be followed by a call to either release or
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.
Note: The entire local data is always accessed, but if a smaller patch is
requested, an appropriately sliced ndarray is returned.
\end{pydesc}
\begin{fdesc}
Provides access to the specified patch of array. Returns leading dimension ld
and and MA-like index for the data. This routine is intended for writing new GA
operations. A call to ga_access should normally follow a 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).
Your code should include a MA include file, mafdecls.h.
\begin{verbatim}
dbl_mb(index) - for double precision data
int_mb(index) - for integer data
dcpl_mb(index) - for double complex data
\end{verbatim}
The addressing convention refers the first element of the patch.
However, you can only pass that reference to another subroutine where it could
be used like a normal array, see the following example.
Example
For a given subroutine:
\begin{verbatim}
subroutine foo(A, nrows, ncols lda)
double precision A(lda,*)
integer nrows, ncols
....
end
\end{verbatim}
you can reference A(ilo:ihi,jlo:jhi) in the following way:
\begin{verbatim}
call foo(dbl_mb(index), ihi-ilo+1, jhi-jlo+1, lda)
\end{verbatim}
Note that the size of the integer index must match the platform, 32-bit
platforms need to use 4-byte integers and 64-bit platforms need to use 8-byte
integers, regardless of whether the other integers in the program are compiled
as 4 or 8-byte integers. This can create portability problems when code is being
built on different platforms. Users can use the preprocessors symbol
GA_ACCESS_INDEX_TYPE to correctly size the integers used as indices across
different architectures. The GA_ACCESS_INDEX_TYPE is used instead of an integer
declaration and the the global.fh file needs to be included in the subroutine.
This will result in code that works for both 32 and 64-bit platforms without
having to explicity convert the integer size.
\end{fdesc}
\apih{ACCESS BLOCK}{Accesses a block in a block-cyclic distributed global array}
\begin{capi}
\begin{ccode}
void NGA_Access_block(int g_a, int idx, void **ptr, int ld[])
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int}{ndim}{number of array dimensions}
\inarg{int}{idx}{block index}
\outarg{void**}{ptr}{pointer to locally held block}
\outarg{int*}{ld[ndim-1]}{array of leading dimensions}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine nga_access_block(g_a, idx, index, ld)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{ndim}{number of array dimensions}
\inarg{integer}{idx}{block index}
\outarg{integer}{index}{reference to local data}
\outarg{integer}{ld(ndim-1)}{array of leading dimensions}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::accessBlock(int idx, void **ptr, int ld[]) const
void GlobalArray::accessBlock(int64_t idx, void **ptr, int64_t ld[]) const
\end{cxxcode}
\begin{funcargs}
\inarg{int}{idx}{index of block}
\outarg{void**}{ptr}{points to location of first element in patch}
\outarg{int*}{ld[ndim-1]}{leading dimensions for the patch elements}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ret = ga.access_block(int g_a, int idx)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int}{idx}{block index}
\outarg{ndarray}{ret}{array representing the block at index idx}
\end{funcargs}
\end{pyapi}
\local
\begin{cdesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a block-cyclic data distribution. The
index idx is the index of the block in the array assuming that blocks are
numbered sequentially in a column-major order. A quick way of determining
whether a block with index idx is held locally on a processor is to calculate
whether idx\%nproc equals the processor ID, where nproc is the total number
of processors. Once the pointer has been returned, local data can be accessed as
described in the documentation for NGA_Access. Each call to NGA_Access_block
should be followed by a call to either NGA_Release_block or
NGA_Release_update_block.
\end{cdesc}
\begin{cxxdesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a block-cyclic data distribution. The
index idx is the index of the block in the array assuming that blocks are
numbered sequentially in a column-major order. A quick way of determining
whether a block with index idx is held locally on a processor is to calculate
whether idx\%nproc equals the processor ID, where nproc is the total number
of processors. Once the pointer has been returned, local data can be accessed as
described in the documentation for access. Each call to accessBlock
should be followed by a call to either ReleaseBlock or
releaseUpdateBlock.
\end{cxxdesc}
\begin{pydesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a block-cyclic data distribution. The
index idx is the index of the block in the array assuming that blocks are
numbered sequentially in a column-major order. A quick way of determining
whether a block with index idx is held locally on a processor is to calculate
whether idx\%nproc equals the processor ID, where nproc is the total number
of processors. Once the array has been returned, local data can be accessed as
described in the documentation for access. Each call to access_block
should be followed by a call to either release_block or
release_update_block.
\end{pydesc}
\begin{fdesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a block-cyclic data distribution. The
index idx is the index of the block in the array assuming that blocks are
numbered sequentially in a column-major order. A quick way of determining
whether a block with index idx is held locally on a processor is to calculate
whether mod(idx,nproc) equals the processor ID, where nproc is the total number
of processors. Once the index has been returned, local data can be accessed as
described in the documentation for nga_access. Each call to nga_access_block
should be followed by a call to either nga_release_block or
nga_release_update_block.
Please check the documentation for the nga_access function for more information on
how to use the index returned by this subroutine to access locally held data.
\end{fdesc}
\seealso{ACCESS,RELEASE BLOCK,RELEASE UPDATE BLOCK}
\apih{ACCESS BLOCK GRID}{Accesses data block in a block-cyclic distributed global array}
\begin{capi}
\begin{ccode}
void NGA_Access_block_grid(int g_a, int subscript[], void **ptr, int ld[])
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int}{ndim}{number of array dimensions}
\inarg{int*}{subscript[ndim]}{subscript of block in array}
\outarg{void**}{ptr}{pointer to locally held bloc}
\outarg{int*}{ld[ndim-1]}{array of leading dimensions}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine nga_access_block_grid(g_a, subscript, index, ld)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{ndim}{number of array dimensions}
\inarg{integer}{subscript(ndim)}{subscript of block in array}
\outarg{integer}{index}{reference to local data}
\outarg{integer}{ld(ndim-1)}{array of leading dimensions}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::accessBlockGrid(int index[], void **ptr, int ld[]) const
void GlobalArray::accessBlockGrid(int64_t index[], void **ptr, int64_t ld[])
const
\end{cxxcode}
\begin{funcargs}
\inarg{int*}{index[ndim]}{indices of block in processor grid}
\outarg{void**}{ptr}{points to location of first element in patch}
\outarg{int*}{ld[ndim-1]}{leading dimensions for the pacth elements}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ret = ga.access_block_grid(int g_a, subscript)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{1D array-like of ints}{subscript}{subscript of block in array}
\outarg{void**}{ret}{pointer to locally held bloc}
\end{funcargs}
\end{pyapi}
\local
\begin{cdesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a SCALAPACK block-cyclic data distribution
that is based on an underlying processor grid. The subscript array contains the
subscript of the block in the array of blocks. This subscript is based on the
location of the block in a grid, each of whose dimensions is equal to the
number of blocks that fit along that dimension. Once the index has been
returned, local data can be accessed as described in the documentation for
NGA_Access. Each call to NGA_Access_block_grid should be followed by a call to
either NGA_Release_block_grid or NGA_Release_update_block_grid.
\end{cdesc}
\begin{cxxdesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a SCALAPACK block-cyclic data distribution
that is based on an underlying processor grid. The subscript array contains the
subscript of the block in the array of blocks. This subscript is based on the
location of the block in a grid, each of whose dimensions is equal to the
number of blocks that fit along that dimension. Once the index has been
returned, local data can be accessed as described in the documentation for
access. Each call to accessBlockGrid should be followed by a call to
either releaseBlockGrid or releaseUpdateBlockGrid.
\end{cxxdesc}
\begin{pydesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a SCALAPACK block-cyclic data distribution
that is based on an underlying processor grid. The subscript array contains the
subscript of the block in the array of blocks. This subscript is based on the
location of the block in a grid, each of whose dimensions is equal to the
number of blocks that fit along that dimension. Once the index has been
returned, local data can be accessed as described in the documentation for
access. Each call to access_block_grid should be followed by a call to
either release_block_grid or release_update_block_grid.
\end{pydesc}
\begin{fdesc}
This function can be used to gain direct access to the data represented by a
single block in a global array with a SCALAPACK block-cyclic data distribution
that is based on an underlying processor grid. The subscript array contains the
subscript of the block in the array of blocks. This subscript is based on the
location of the block in a grid, each of whose dimensions is equal to the
number of blocks that fit along that dimension. Once the index has been
returned, local data can be accessed as described in the documentation for
nga_access. Each call to nga_access_block_grid should be followed by a call to
either nga_release_block_grid or nga_release_update_block_grid.
\end{fdesc}
\seealso{ACCESS,RELEASE BLOCK GRID,RELEASE UPDATE BLOCK GRID}
\apih{ACCESS BLOCK SEGMENT}{Accesses local data for a specific global array block}
\begin{capi}
\begin{ccode}
void NGA_Access_block_segment(int g_a, int proc, void **ptr, int *len)
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int}{proc}{processor ID}
\outarg{void**}{ptr}{pointer to locally held data}
\outarg{int*}{len}{length of data on processor}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine nga_access_block_segment(g_a, proc, index, len)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{proc}{processor ID}
\outarg{integer}{index}{reference to local data}
\outarg{integer}{len}{length of data on processor}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::accessBlockSegment(int index, void **ptr,
int *len) const
void GlobalArray::accessBlockSegment(int index, void **ptr,
int64_t *len) const
\end{cxxcode}
\begin{funcargs}
\inarg{int}{index}{processor ID}
\outarg{void**}{ptr}{points to location of first element}
\outarg{int*}{len}{length of locally held data}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ret = ga.access_block(int g_a, int proc)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int}{proc}{processor ID}
\outarg{ndarray}{ret}{locally held data}
\end{funcargs}
\end{pyapi}
\local
\begin{cdesc}
This function can be used to gain access to the all the locally held data on a
particular processor that is associated with a block-cyclic distributed array.
Once the index has been returned, local data can be accessed as described in
the documentation for NGA_Access. The parameter len is the number of data
elements that are held locally. The data inside this segment has a lot of
additional structure so this function is not generally useful to developers. It
is primarily used inside the GA library to implement other GA routines. Each
call to NGA_Access_block_segment should be followed by a call to either
NGA_Release_block_segment or NGA_Release_update_block_segment.
\end{cdesc}
\begin{cxxdesc}
This function can be used to gain access to the all the locally held data on a
particular processor that is associated with a block-cyclic distributed array.
Once the index has been returned, local data can be accessed as described in
the documentation for access. The parameter len is the number of data
elements that are held locally. The data inside this segment has a lot of
additional structure so this function is not generally useful to developers. It
is primarily used inside the GA library to implement other GA routines. Each
call to accessBlockSegment should be followed by a call to either
releaseBlockSegment or releaseUpdateBlockSegment.
\end{cxxdesc}
\begin{pydesc}
This function can be used to gain access to the all the locally held data on a
particular processor that is associated with a block-cyclic distributed array.
Once the index has been returned, local data can be accessed as described in
the documentation for access. The parameter len is the number of data
elements that are held locally. The data inside this segment has a lot of
additional structure so this function is not generally useful to developers. It
is primarily used inside the GA library to implement other GA routines. Each
call to access_block_segment should be followed by a call to either
release_block_segment or release_update_block_segment.
\end{pydesc}
\begin{fdesc}
This function can be used to gain access to the all the locally held data on a
particular processor that is associated with a block-cyclic distributed array.
Once the index has been returned, local data can be accessed as described in
the documentation for nga_access. The parameter len is the number of data
elements that are held locally. The data inside this segment has a lot of
additional structure so this function is not generally useful to developers. It
is primarily used inside the GA library to implement other GA routines. Each
call to nga_access_block_segment should be followed by a call to either
nga_release_block_segment or nga_release_update_block_segment.
\end{fdesc}
\seealso{ACCESS,RELEASE BLOCK SEGMENT,RELEASE UPDATE BLOCK SEGMENT}
\apih{ACCESS GHOST ELEMENT}{Accesses a specific ghost element locally allocated on a GA}
\begin{capi}
\begin{ccode}
void NGA_Access_ghost_element(int g_a, void **ptr, int subscript[],
int ld[])
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\outarg{void**}{ptr}{pointer to location of element indexed by subscript[]}
\inarg{int*}{subscript[ndim]}{array of integers that index desired element}
\outarg{int*}{ld[ndim-1]}{array of strides for local data patch. These include ghost cell widths.}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine nga_access_ghost_element(g_a, index, subscript, ld)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\outarg{integer}{index}{index pointing to location of element indexed by subscript()}
\inarg{integer}{subscript(ndim)}{array of integers that index desired element}
\outarg{integer}{ld(ndim-1)}{array of strides for local data patch. These include ghost cell widths.}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::accessGhostElement(void **ptr, int subscript[],
int ld[]) const
void GlobalArray::accessGhostElement(void **ptr, int64_t subscript[],
int64_t ld[]) const
\end{cxxcode}
\begin{funcargs}
\outarg{void**}{ptr}{index pointing to location of element indexed by subscript[]}
\inarg{int*}{subscript[ndim]}{array of integers that index desired element}
\outarg{int*}{ld[ndim-1]}{array of strides for local data patch. These include ghost cell widths.}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ret = ga.access_ghost_element(int g_a, subscript)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{the array handle}
\inarg{1D array-like of ints}{subscript}{index of desired element}
\outarg{ndarray}{ret}{appropriately shaped, possibly non-contiguous ndarray corresponding to global array patch held locally on the processor}
\end{funcargs}
\end{pyapi}
\local
\begin{desc}
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,...)).
\end{desc}
\begin{fdesc}
To use the index returned by the nga_access_ghost_element subroutine, see the
documentation on nga_access.
\end{fdesc}
\seealso{ACCESS,RELEASE GHOST ELEMENT,RELEASE UPDATE GHOST ELEMENT}
\apih{ACCESS GHOSTS}{Accesses the ghost cells allocated locally on a GA}
\begin{capi}
\begin{ccode}
void NGA_Access_ghosts(int g_a, int dims[], void **ptr, int ld[])
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\outarg{int*}{dims[ndim]}{array of dimensions of local patch, including ghost cells}
\outarg{void**}{ptr}{returns a pointer corresponding to the origin the global array patch held locally on the processor}
\outarg{int*}{ld[ndim-1]}{physical dimenstions of the local array patch, including ghost cells}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine nga_access_ghosts(g_a, dims, index, ld)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\outarg{integer}{dims(ndim)}{array of dimensions of local patch, including ghost cells}
\outarg{integer}{index}{returns an index corresponding to the origin the global array patch held locally on the processor}
\outarg{integer}{ld(ndim)}{physical dimenstions of the local array patch, including ghost cells}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::accessGhosts(int dims[], void **ptr, int ld[]) const
void GlobalArray::accessGhosts(int64_t dims[], void **ptr, int64_t ld[]) const
\end{cxxcode}
\begin{funcargs}
\outarg{int*}{dims[ndim]}{array of dimensions of local patch, including ghost cells}
\outarg{void**}{ptr}{returns an index corresponding to the origin the global array patch held locally on the processor}
\outarg{int*}{ld[ndim-1]}{physical dimensions of the local array patch, including ghost cells}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ret = ga.access_ghosts(int g_a)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{the array handle}
\outarg{ndarray}{ret}{appropriately shaped, possibly non-contiguous ndarray corresponding to global array patch held locally on the processor}
\end{funcargs}
\end{pyapi}
\local
\begin{cdesc}
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 NGA_Access_ghosts
should normally follow a call to NGA_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
NGA_Distribution).
You can only access local data.
\end{cdesc}
\begin{cxxdesc}
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.
\end{cxxdesc}
\begin{pydesc}
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 access_ghosts
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.
\end{pydesc}
\begin{fdesc}
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 nga_access_ghosts
should normally follow a call to nga_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
nga_distribution).
You can only access local data. To see how to use the index returned by this
subroutine, check the documentation on nga_acces.
\end{fdesc}
\seealso{ACCESS,RELEASE GHOSTS,RELEASE UPDATE GHOSTS}
\apih{ADD}{Adds corresponding values in two global arrays}
\begin{capi}
\begin{ccode}
void GA_Add(void *alpha, int g_a, void* beta, int g_b, int g_c)
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int}{g_b}{array handle}
\inarg{int}{g_c}{array handle}
\inarg{double/complex/int*}{alpha}{scale factor}
\inarg{double/complex/int*}{beta}{scale factor}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine ga_add(alpha, g_a, beta, g_b, g_c)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{g_b}{array handle}
\inarg{integer}{g_c}{array handle}
\inarg{double precision/complex/integer}{alpha,beta}{}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::add(void *alpha, const GlobalArray * g_a, void *beta, const GlobalArray * g_b) const
\end{cxxcode}
\begin{funcargs}
\inarg{void*}{alpha}{scale factor}
\inarg{int}{g_a}{array}
\inarg{void*}{beta}{scale factor}
\inarg{int}{g_b}{array}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ga.add(int g_a, int g_b, int g_c, alpha=None, beta=None)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{the array handle}
\inarg{int}{g_b}{the array handle}
\inarg{int}{g_c}{the array handle}
\inarg{object}{alpha}{multiplier (converted to appropriate type)}
\inarg{object}{beta}{multiplier (converted to appropriate type)}
\end{funcargs}
\end{pyapi}
\gcoll
\begin{desc}
The arrays (which must be the same shape and identically aligned) are added
together element-wise.
\begin{verbatim}
c = alpha * a + beta * b;
\end{verbatim}
The result (c) may replace one of the input arrays (a/b).
\end{desc}
\apih{ADD CONSTANT}{Adds a constant to all elements in a global array}
\begin{capi}
\begin{ccode}
void GA_Add_constant(int g_a, void *alpha)
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{void*}{alpha}{double/complex/int/long/float* added value}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine ga_add_constant(g_a, alpha)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{double/complex/integer/float}{alpha}{added value}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::addConstant(void* alpha) const
\end{cxxcode}
\begin{funcargs}
\inarg{void*}{alpha}{double/complex/int/long/float* constant to be added}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ga.add_constant(int g_a, alpha)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{object}{alpha}{constant to add (converted to appropriate type)}
\end{funcargs}
\end{pyapi}
\gcoll
\begin{desc}
Add the constant pointed by alpha to each element of the array.
\end{desc}
\apih{ADD CONSTANT PATCH}{Adds a constant to all elements in a global array patch}
\begin{capi}
\begin{ccode}
void GA_Add_constant_patch(int g_a, int lo[], int hi[], void *alpha)
\end{ccode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{int*}{lo[], hi[]}{patch coordinates}
\inarg{void*}{alpha}{double/complex/int/long/float* added value}
\end{funcargs}
\end{capi}
\begin{fapi}
\begin{fcode}
subroutine ga_add_constant_patch(g_a, lo, hi, alpha)
\end{fcode}
\begin{funcargs}
\inarg{integer}{g_a}{array handle}
\inarg{integer}{ndim}{number of dimensions}
\inarg{integer}{lo(ndim), hi(ndim)}{patch coordinates}
\inarg{double/complex/integer/float}{alpha}{added value}
\end{funcargs}
\end{fapi}
\begin{cxxapi}
\begin{cxxcode}
void GlobalArray::addConstantPatch(int *lo, int *hi, void *alpha) const
void GlobalArray::addConstantPatch(int64_t *lo, int64_t *hi, void *alpha) const
\end{cxxcode}
\begin{funcargs}
\inarg{int*}{lo}{lower corner patch coordinates}
\inarg{int*}{hi}{upper corner patch coordinates}
\inarg{void*}{alpha}{double/complex/int/long/float constant to be added}
\end{funcargs}
\end{cxxapi}
\begin{pyapi}
\begin{pycode}
ga.add_constant(int g_a, alpha, lo=None, hi=None)
\end{pycode}
\begin{funcargs}
\inarg{int}{g_a}{array handle}
\inarg{object}{alpha}{constant to add (converted to appropriate type)}