1 /**
2 * @file capi.c
3 *
4 * Implements the C interface.
5 * These calls forward to the (possibly) weak symbols of the internal
6 * implementations.
7 */
8 #if HAVE_CONFIG_H
9 # include "config.h"
10 #endif
11
12 #if HAVE_STDIO_H
13 # include <stdio.h>
14 #endif
15 #if HAVE_STDLIB_H
16 # include <stdlib.h>
17 #endif
18 #include <assert.h>
19
20 #include "armci.h"
21 #include "ga.h"
22 #include "globalp.h"
23 #include "ga-papi.h"
24 #include "matmul.h"
25
26 #if ENABLE_PROFILING
27 # include "ga-wapi.h"
28 #else
29 # include "ga-wapidefs.h"
30 #endif
31
32 #define USE_GATSCAT_NEW
33
34 int *_ga_argc=NULL;
35 char ***_ga_argv=NULL;
36 int _ga_initialize_args=0;
37 int _ga_initialize_c=0;
38
39 short int _ga_irreg_flag = 0;
40
41 static Integer* copy_map(int block[], int block_ndim, int map[]);
42 static Integer* copy_map64(int64_t block[], int block_ndim, int64_t map[]);
43
44 #ifdef USE_FAPI
45 # define COPYC2F(carr, farr, n){\
46 int i; for(i=0; i< (n); i++)(farr)[i]=(Integer)(carr)[i];}
47 # define COPYF2C(farr, carr, n){\
48 int i; for(i=0; i< (n); i++)(carr)[i]=(int)(farr)[i];}
49 # define COPYF2C_64(farr, carr, n){\
50 int i; for(i=0; i< (n); i++)(carr)[i]=(int64_t)(farr)[i];}
51 # define COPYINDEX_F2C COPYF2C
52 # define COPYINDEX_F2C_64 COPYF2C_64
53 #else
54 # define COPYC2F(carr, farr, n){\
55 int i; for(i=0; i< (n); i++)(farr)[n-i-1]=(Integer)(carr)[i];}
56 # define COPYF2C(farr, carr, n){\
57 int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(int)(farr)[i];}
58 # define COPYF2C_64(farr, carr, n){\
59 int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(int64_t)(farr)[i];}
60 # define COPYINDEX_C2F(carr, farr, n){\
61 int i; for(i=0; i< (n); i++)(farr)[n-i-1]=(Integer)(carr)[i]+1;}
62 # define COPYINDEX_F2C(farr, carr, n){\
63 int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(int)(farr)[i] -1;}
64 # define COPYINDEX_F2C_64(farr, carr, n){\
65 int i; for(i=0; i< (n); i++)(carr)[n-i-1]=(int64_t)(farr)[i] -1;}
66 #define BASE_0
67 #endif
68
69 #define COPY(CAST,src,dst,n) {\
70 int i; for(i=0; i< (n); i++)(dst)[i]=(CAST)(src)[i];}
71 #define COPY_INC(CAST,src,dst,n) {\
72 int i; for(i=0; i< (n); i++)(dst)[i]=(CAST)(src)[i]+1;}
73 #define COPY_DEC(CAST,src,dst,n) {\
74 int i; for(i=0; i< (n); i++)(dst)[i]=(CAST)(src)[i]-1;}
75
GA_Uses_fapi(void)76 int GA_Uses_fapi(void)
77 {
78 #ifdef USE_FAPI
79 return 1;
80 #else
81 return 0;
82 #endif
83 }
84
85
GA_Initialize_ltd(size_t limit)86 void GA_Initialize_ltd(size_t limit)
87 {
88 Integer lim = (Integer)limit;
89 _ga_initialize_c = 1;
90 wnga_initialize_ltd(lim);
91 }
92
NGA_Initialize_ltd(size_t limit)93 void NGA_Initialize_ltd(size_t limit)
94 {
95 Integer lim = (Integer)limit;
96 _ga_initialize_c = 1;
97 wnga_initialize_ltd(lim);
98 }
99
GA_Initialize_args(int * argc,char *** argv)100 void GA_Initialize_args(int *argc, char ***argv)
101 {
102 _ga_argc = argc;
103 _ga_argv = argv;
104 _ga_initialize_c = 1;
105 _ga_initialize_args = 1;
106
107 wnga_initialize();
108 }
109
GA_Initialize()110 void GA_Initialize()
111 {
112 _ga_initialize_c = 1;
113 wnga_initialize();
114 }
115
NGA_Initialize()116 void NGA_Initialize()
117 {
118 _ga_initialize_c = 1;
119 wnga_initialize();
120 }
121
GA_Initialized()122 int GA_Initialized()
123 {
124 return wnga_initialized();
125 }
126
NGA_Initialized()127 int NGA_Initialized()
128 {
129 return wnga_initialized();
130 }
131
GA_Terminate()132 void GA_Terminate()
133 {
134 wnga_terminate();
135
136 _ga_argc = NULL;
137 _ga_argv = NULL;
138 _ga_initialize_args = 0;
139 _ga_initialize_c = 0;
140 }
141
NGA_Terminate()142 void NGA_Terminate()
143 {
144 wnga_terminate();
145
146 _ga_argc = NULL;
147 _ga_argv = NULL;
148 _ga_initialize_args = 0;
149 _ga_initialize_c = 0;
150 }
151
NGA_Create(int type,int ndim,int dims[],char * name,int * chunk)152 int NGA_Create(int type, int ndim, int dims[], char *name, int *chunk)
153 {
154 Integer *ptr, g_a;
155 logical st;
156 Integer _ga_work[MAXDIM];
157 Integer _ga_dims[MAXDIM];
158 if(ndim>MAXDIM)return 0;
159
160 COPYC2F(dims,_ga_dims, ndim);
161 if(!chunk)ptr=(Integer*)0;
162 else {
163 COPYC2F(chunk,_ga_work, ndim);
164 ptr = _ga_work;
165 }
166 st = wnga_create((Integer)type, (Integer)ndim, _ga_dims, name, ptr, &g_a);
167 if(st==TRUE) return (int) g_a;
168 else return 0;
169 }
170
NGA_Create64(int type,int ndim,int64_t dims[],char * name,int64_t * chunk)171 int NGA_Create64(int type, int ndim, int64_t dims[], char *name, int64_t *chunk)
172 {
173 Integer *ptr, g_a;
174 logical st;
175 Integer _ga_dims[MAXDIM];
176 Integer _ga_work[MAXDIM];
177 if(ndim>MAXDIM)return 0;
178
179 COPYC2F(dims,_ga_dims, ndim);
180 if(!chunk)ptr=(Integer*)0;
181 else {
182 COPYC2F(chunk,_ga_work, ndim);
183 ptr = _ga_work;
184 }
185 st = wnga_create((Integer)type, (Integer)ndim, _ga_dims, name, ptr, &g_a);
186 if(st==TRUE) return (int) g_a;
187 else return 0;
188 }
189
NGA_Create_config(int type,int ndim,int dims[],char * name,int chunk[],int p_handle)190 int NGA_Create_config(int type, int ndim, int dims[], char *name, int chunk[],
191 int p_handle)
192 {
193 Integer *ptr, g_a;
194 logical st;
195 Integer _ga_dims[MAXDIM];
196 Integer _ga_work[MAXDIM];
197 if(ndim>MAXDIM)return 0;
198
199 COPYC2F(dims,_ga_dims, ndim);
200 if(!chunk)ptr=(Integer*)0;
201 else {
202 COPYC2F(chunk,_ga_work, ndim);
203 ptr = _ga_work;
204 }
205 st = wnga_create_config((Integer)type, (Integer)ndim, _ga_dims, name, ptr,
206 (Integer)p_handle, &g_a);
207 if(st==TRUE) return (int) g_a;
208 else return 0;
209 }
210
211
NGA_Create_config64(int type,int ndim,int64_t dims[],char * name,int64_t chunk[],int p_handle)212 int NGA_Create_config64(int type, int ndim, int64_t dims[], char *name, int64_t chunk[], int p_handle)
213 {
214 Integer *ptr, g_a;
215 logical st;
216 Integer _ga_dims[MAXDIM];
217 Integer _ga_work[MAXDIM];
218 if(ndim>MAXDIM)return 0;
219
220 COPYC2F(dims,_ga_dims, ndim);
221 if(!chunk)ptr=(Integer*)0;
222 else {
223 COPYC2F(chunk,_ga_work, ndim);
224 ptr = _ga_work;
225 }
226 st = wnga_create_config((Integer)type, (Integer)ndim, _ga_dims, name, ptr,
227 (Integer)p_handle, &g_a);
228 if(st==TRUE) return (int) g_a;
229 else return 0;
230 }
231
NGA_Create_irreg(int type,int ndim,int dims[],char * name,int block[],int map[])232 int NGA_Create_irreg(int type,int ndim,int dims[],char *name,int block[],int map[])
233 {
234 Integer g_a;
235 logical st;
236 Integer _ga_dims[MAXDIM];
237 Integer _ga_work[MAXDIM];
238 Integer *_ga_map_capi;
239 if(ndim>MAXDIM)return 0;
240
241 COPYC2F(dims,_ga_dims, ndim);
242 COPYC2F(block,_ga_work, ndim);
243 _ga_map_capi = copy_map(block, ndim, map);
244
245 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
246 st = wnga_create_irreg(type, (Integer)ndim, _ga_dims, name, _ga_map_capi,
247 _ga_work, &g_a);
248 _ga_irreg_flag = 0; /* unset it after creating the array */
249
250 free(_ga_map_capi);
251 if(st==TRUE) return (int) g_a;
252 else return 0;
253 }
254
NGA_Create_irreg64(int type,int ndim,int64_t dims[],char * name,int64_t block[],int64_t map[])255 int NGA_Create_irreg64(int type,int ndim,int64_t dims[],char *name,int64_t block[],int64_t map[])
256 {
257 Integer g_a;
258 logical st;
259 Integer _ga_dims[MAXDIM];
260 Integer _ga_work[MAXDIM];
261 Integer *_ga_map_capi;
262 if(ndim>MAXDIM)return 0;
263
264 COPYC2F(dims,_ga_dims, ndim);
265 COPYC2F(block,_ga_work, ndim);
266 _ga_map_capi = copy_map64(block, ndim, map);
267
268 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
269 st = wnga_create_irreg(type, (Integer)ndim, _ga_dims, name, _ga_map_capi,
270 _ga_work, &g_a);
271 _ga_irreg_flag = 0; /* unset it after creating the array */
272
273 free(_ga_map_capi);
274 if(st==TRUE) return (int) g_a;
275 else return 0;
276 }
277
NGA_Create_irreg_config(int type,int ndim,int dims[],char * name,int block[],int map[],int p_handle)278 int NGA_Create_irreg_config(int type,int ndim,int dims[],char *name,int block[],
279 int map[], int p_handle)
280 {
281 Integer g_a;
282 logical st;
283 Integer _ga_dims[MAXDIM];
284 Integer _ga_work[MAXDIM];
285 Integer *_ga_map_capi;
286 if(ndim>MAXDIM)return 0;
287
288 COPYC2F(dims,_ga_dims, ndim);
289 COPYC2F(block,_ga_work, ndim);
290 _ga_map_capi = copy_map(block, ndim, map);
291
292 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
293 st = wnga_create_irreg_config(type, (Integer)ndim, _ga_dims, name,
294 _ga_map_capi, _ga_work, (Integer)p_handle, &g_a);
295 _ga_irreg_flag = 0; /* unset it, after creating array */
296
297 free(_ga_map_capi);
298 if(st==TRUE) return (int) g_a;
299 else return 0;
300 }
301
NGA_Create_irreg_config64(int type,int ndim,int64_t dims[],char * name,int64_t block[],int64_t map[],int p_handle)302 int NGA_Create_irreg_config64(int type,int ndim,int64_t dims[],char *name,int64_t block[], int64_t map[], int p_handle)
303 {
304 Integer g_a;
305 logical st;
306 Integer _ga_dims[MAXDIM];
307 Integer _ga_work[MAXDIM];
308 Integer *_ga_map_capi;
309 if(ndim>MAXDIM)return 0;
310
311 COPYC2F(dims,_ga_dims, ndim);
312 COPYC2F(block,_ga_work, ndim);
313 _ga_map_capi = copy_map64(block, ndim, map);
314
315 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
316 st = wnga_create_irreg_config(type, (Integer)ndim, _ga_dims, name,
317 _ga_map_capi, _ga_work, (Integer)p_handle, &g_a);
318 _ga_irreg_flag = 0; /* unset it, after creating array */
319
320 free(_ga_map_capi);
321 if(st==TRUE) return (int) g_a;
322 else return 0;
323 }
324
NGA_Create_ghosts_irreg(int type,int ndim,int dims[],int width[],char * name,int block[],int map[])325 int NGA_Create_ghosts_irreg(int type,int ndim,int dims[],int width[],char *name, int block[],int map[])
326 {
327 Integer g_a;
328 logical st;
329 Integer _ga_dims[MAXDIM];
330 Integer _ga_work[MAXDIM];
331 Integer _ga_width[MAXDIM];
332 Integer *_ga_map_capi;
333 if(ndim>MAXDIM)return 0;
334
335 COPYC2F(dims,_ga_dims, ndim);
336 COPYC2F(block,_ga_work, ndim);
337 COPYC2F(width,_ga_width, ndim);
338 _ga_map_capi = copy_map(block, ndim, map);
339
340 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
341 st = wnga_create_ghosts_irreg(type, (Integer)ndim, _ga_dims, _ga_width,
342 name, _ga_map_capi, _ga_work, &g_a);
343 _ga_irreg_flag = 0; /* unset it, after creating array */
344
345 free(_ga_map_capi);
346 if(st==TRUE) return (int) g_a;
347 else return 0;
348 }
349
NGA_Create_ghosts_irreg64(int type,int ndim,int64_t dims[],int64_t width[],char * name,int64_t block[],int64_t map[])350 int NGA_Create_ghosts_irreg64(int type,int ndim,int64_t dims[],int64_t width[],char *name, int64_t block[],int64_t map[])
351 {
352 Integer g_a;
353 logical st;
354 Integer _ga_dims[MAXDIM];
355 Integer _ga_work[MAXDIM];
356 Integer _ga_width[MAXDIM];
357 Integer *_ga_map_capi;
358 if(ndim>MAXDIM)return 0;
359
360 COPYC2F(dims,_ga_dims, ndim);
361 COPYC2F(block,_ga_work, ndim);
362 COPYC2F(width,_ga_width, ndim);
363 _ga_map_capi = copy_map64(block, ndim, map);
364
365 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
366 st = wnga_create_ghosts_irreg(type, (Integer)ndim, _ga_dims, _ga_width,
367 name, _ga_map_capi, _ga_work, &g_a);
368 _ga_irreg_flag = 0; /* unset it, after creating array */
369
370 free(_ga_map_capi);
371 if(st==TRUE) return (int) g_a;
372 else return 0;
373 }
374
NGA_Create_ghosts_irreg_config(int type,int ndim,int dims[],int width[],char * name,int block[],int map[],int p_handle)375 int NGA_Create_ghosts_irreg_config(int type, int ndim, int dims[], int width[], char *name, int block[], int map[], int p_handle)
376 {
377 Integer g_a;
378 logical st;
379 Integer _ga_dims[MAXDIM];
380 Integer _ga_work[MAXDIM];
381 Integer _ga_width[MAXDIM];
382 Integer *_ga_map_capi;
383 if(ndim>MAXDIM)return 0;
384
385 COPYC2F(dims,_ga_dims, ndim);
386 COPYC2F(block,_ga_work, ndim);
387 COPYC2F(width,_ga_width, ndim);
388 _ga_map_capi = copy_map(block, ndim, map);
389
390 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
391 st = wnga_create_ghosts_irreg_config(type, (Integer)ndim, _ga_dims,
392 _ga_width, name, _ga_map_capi, _ga_work,
393 (Integer)p_handle, &g_a);
394 _ga_irreg_flag = 0; /* unset it, after creating array */
395
396 free(_ga_map_capi);
397 if(st==TRUE) return (int) g_a;
398 else return 0;
399 }
400
NGA_Create_ghosts_irreg_config64(int type,int ndim,int64_t dims[],int64_t width[],char * name,int64_t block[],int64_t map[],int p_handle)401 int NGA_Create_ghosts_irreg_config64(int type, int ndim, int64_t dims[], int64_t width[], char *name, int64_t block[], int64_t map[], int p_handle)
402 {
403 Integer g_a;
404 logical st;
405 Integer _ga_dims[MAXDIM];
406 Integer _ga_work[MAXDIM];
407 Integer _ga_width[MAXDIM];
408 Integer *_ga_map_capi;
409 if(ndim>MAXDIM)return 0;
410
411 COPYC2F(dims,_ga_dims, ndim);
412 COPYC2F(block,_ga_work, ndim);
413 COPYC2F(width,_ga_width, ndim);
414 _ga_map_capi = copy_map64(block, ndim, map);
415
416 _ga_irreg_flag = 1; /* set this flag=1, to indicate array is irregular */
417 st = wnga_create_ghosts_irreg_config(type, (Integer)ndim, _ga_dims,
418 _ga_width, name, _ga_map_capi, _ga_work,
419 (Integer)p_handle, &g_a);
420 _ga_irreg_flag = 0; /* unset it, after creating array */
421
422 free(_ga_map_capi);
423 if(st==TRUE) return (int) g_a;
424 else return 0;
425 }
426
NGA_Create_ghosts(int type,int ndim,int dims[],int width[],char * name,int chunk[])427 int NGA_Create_ghosts(int type, int ndim,int dims[], int width[], char *name,
428 int chunk[])
429 {
430 Integer *ptr, g_a;
431 logical st;
432 Integer _ga_dims[MAXDIM];
433 Integer _ga_work[MAXDIM];
434 Integer _ga_width[MAXDIM];
435 if(ndim>MAXDIM)return 0;
436
437 COPYC2F(dims,_ga_dims, ndim);
438 COPYC2F(width,_ga_width, ndim);
439 if(!chunk)ptr=(Integer*)0;
440 else {
441 COPYC2F(chunk,_ga_work, ndim);
442 ptr = _ga_work;
443 }
444 st = wnga_create_ghosts((Integer)type, (Integer)ndim, _ga_dims,
445 _ga_width, name, ptr, &g_a);
446 if(st==TRUE) return (int) g_a;
447 else return 0;
448 }
449
450
NGA_Create_ghosts64(int type,int ndim,int64_t dims[],int64_t width[],char * name,int64_t chunk[])451 int NGA_Create_ghosts64(int type, int ndim, int64_t dims[], int64_t width[], char *name,
452 int64_t chunk[])
453 {
454 Integer *ptr, g_a;
455 logical st;
456 Integer _ga_dims[MAXDIM];
457 Integer _ga_work[MAXDIM];
458 Integer _ga_width[MAXDIM];
459 if(ndim>MAXDIM)return 0;
460
461 COPYC2F(dims,_ga_dims, ndim);
462 COPYC2F(width,_ga_width, ndim);
463 if(!chunk)ptr=(Integer*)0;
464 else {
465 COPYC2F(chunk,_ga_work, ndim);
466 ptr = _ga_work;
467 }
468 st = wnga_create_ghosts((Integer)type, (Integer)ndim, _ga_dims,
469 _ga_width, name, ptr, &g_a);
470 if(st==TRUE) return (int) g_a;
471 else return 0;
472 }
473
474
NGA_Create_ghosts_config(int type,int ndim,int dims[],int width[],char * name,int chunk[],int p_handle)475 int NGA_Create_ghosts_config(int type, int ndim,int dims[], int width[], char *name,
476 int chunk[], int p_handle)
477 {
478 Integer *ptr, g_a;
479 logical st;
480 Integer _ga_dims[MAXDIM];
481 Integer _ga_work[MAXDIM];
482 Integer _ga_width[MAXDIM];
483 if(ndim>MAXDIM)return 0;
484
485 COPYC2F(dims,_ga_dims, ndim);
486 COPYC2F(width,_ga_width, ndim);
487 if(!chunk)ptr=(Integer*)0;
488 else {
489 COPYC2F(chunk,_ga_work, ndim);
490 ptr = _ga_work;
491 }
492 st = wnga_create_ghosts_config((Integer)type, (Integer)ndim, _ga_dims,
493 _ga_width, name, ptr, (Integer)p_handle, &g_a);
494 if(st==TRUE) return (int) g_a;
495 else return 0;
496 }
497
NGA_Create_ghosts_config64(int type,int ndim,int64_t dims[],int64_t width[],char * name,int64_t chunk[],int p_handle)498 int NGA_Create_ghosts_config64(int type, int ndim,int64_t dims[], int64_t width[], char *name,
499 int64_t chunk[], int p_handle)
500 {
501 Integer *ptr, g_a;
502 logical st;
503 Integer _ga_dims[MAXDIM];
504 Integer _ga_work[MAXDIM];
505 Integer _ga_width[MAXDIM];
506 if(ndim>MAXDIM)return 0;
507
508 COPYC2F(dims,_ga_dims, ndim);
509 COPYC2F(width,_ga_width, ndim);
510 if(!chunk)ptr=(Integer*)0;
511 else {
512 COPYC2F(chunk,_ga_work, ndim);
513 ptr = _ga_work;
514 }
515 st = wnga_create_ghosts_config((Integer)type, (Integer)ndim, _ga_dims,
516 _ga_width, name, ptr, (Integer)p_handle, &g_a);
517 if(st==TRUE) return (int) g_a;
518 else return 0;
519 }
520
GA_Create_handle()521 int GA_Create_handle()
522 {
523 Integer g_a;
524 g_a = wnga_create_handle();
525 return (int)g_a;
526 }
527
NGA_Create_handle()528 int NGA_Create_handle()
529 {
530 Integer g_a;
531 g_a = wnga_create_handle();
532 return (int)g_a;
533 }
534
GA_Set_data(int g_a,int ndim,int dims[],int type)535 void GA_Set_data(int g_a, int ndim, int dims[], int type)
536 {
537 Integer aa, nndim, ttype;
538 Integer _ga_dims[MAXDIM];
539 COPYC2F(dims,_ga_dims, ndim);
540 aa = (Integer)g_a;
541 nndim = (Integer)ndim;
542 ttype = (Integer)type;
543 wnga_set_data(aa, nndim, _ga_dims, ttype);
544 }
545
GA_Set_data64(int g_a,int ndim,int64_t dims[],int type)546 void GA_Set_data64(int g_a, int ndim, int64_t dims[], int type)
547 {
548 Integer aa, nndim, ttype;
549 Integer _ga_dims[MAXDIM];
550 COPYC2F(dims,_ga_dims, ndim);
551 aa = (Integer)g_a;
552 nndim = (Integer)ndim;
553 ttype = (Integer)type;
554 wnga_set_data(aa, nndim, _ga_dims, ttype);
555 }
556
NGA_Set_data(int g_a,int ndim,int dims[],int type)557 void NGA_Set_data(int g_a, int ndim, int dims[], int type)
558 {
559 Integer aa, nndim, ttype;
560 Integer _ga_dims[MAXDIM];
561 COPYC2F(dims,_ga_dims, ndim);
562 aa = (Integer)g_a;
563 nndim = (Integer)ndim;
564 ttype = (Integer)type;
565 wnga_set_data(aa, nndim, _ga_dims, ttype);
566 }
567
NGA_Set_data64(int g_a,int ndim,int64_t dims[],int type)568 void NGA_Set_data64(int g_a, int ndim, int64_t dims[], int type)
569 {
570 Integer aa, nndim, ttype;
571 Integer _ga_dims[MAXDIM];
572 COPYC2F(dims,_ga_dims, ndim);
573 aa = (Integer)g_a;
574 nndim = (Integer)ndim;
575 ttype = (Integer)type;
576 wnga_set_data(aa, nndim, _ga_dims, ttype);
577 }
578
GA_Set_chunk(int g_a,int chunk[])579 void GA_Set_chunk(int g_a, int chunk[])
580 {
581 Integer aa, *ptr, ndim;
582 Integer _ga_work[MAXDIM];
583 aa = (Integer)g_a;
584 ndim = wnga_get_dimension(aa);
585 if(!chunk)ptr=(Integer*)0;
586 else {
587 COPYC2F(chunk,_ga_work, ndim);
588 ptr = _ga_work;
589 }
590 wnga_set_chunk(aa, ptr);
591 }
592
GA_Set_chunk64(int g_a,int64_t chunk[])593 void GA_Set_chunk64(int g_a, int64_t chunk[])
594 {
595 Integer aa, *ptr, ndim;
596 Integer _ga_work[MAXDIM];
597 aa = (Integer)g_a;
598 ndim = wnga_get_dimension(aa);
599 if(!chunk)ptr=(Integer*)0;
600 else {
601 COPYC2F(chunk,_ga_work, ndim);
602 ptr = _ga_work;
603 }
604 wnga_set_chunk(aa, ptr);
605 }
606
NGA_Set_chunk(int g_a,int chunk[])607 void NGA_Set_chunk(int g_a, int chunk[])
608 {
609 Integer aa, *ptr, ndim;
610 Integer _ga_work[MAXDIM];
611 aa = (Integer)g_a;
612 ndim = wnga_get_dimension(aa);
613 if(!chunk)ptr=(Integer*)0;
614 else {
615 COPYC2F(chunk,_ga_work, ndim);
616 ptr = _ga_work;
617 }
618 wnga_set_chunk(aa, ptr);
619 }
620
NGA_Set_chunk64(int g_a,int64_t chunk[])621 void NGA_Set_chunk64(int g_a, int64_t chunk[])
622 {
623 Integer aa, *ptr, ndim;
624 Integer _ga_work[MAXDIM];
625 aa = (Integer)g_a;
626 ndim = wnga_get_dimension(aa);
627 if(!chunk)ptr=(Integer*)0;
628 else {
629 COPYC2F(chunk,_ga_work, ndim);
630 ptr = _ga_work;
631 }
632 wnga_set_chunk(aa, ptr);
633 }
634
GA_Set_array_name(int g_a,char * name)635 void GA_Set_array_name(int g_a, char *name)
636 {
637 Integer aa;
638 aa = (Integer)g_a;
639 wnga_set_array_name(aa, name);
640 }
641
NGA_Set_array_name(int g_a,char * name)642 void NGA_Set_array_name(int g_a, char *name)
643 {
644 Integer aa;
645 aa = (Integer)g_a;
646 wnga_set_array_name(aa, name);
647 }
648
GA_Get_array_name(int g_a,char * name)649 void GA_Get_array_name(int g_a, char *name)
650 {
651 Integer aa;
652 aa = (Integer)g_a;
653 wnga_get_array_name(aa, name);
654 }
655
NGA_Get_array_name(int g_a,char * name)656 void NGA_Get_array_name(int g_a, char *name)
657 {
658 Integer aa;
659 aa = (Integer)g_a;
660 wnga_get_array_name(aa, name);
661 }
662
GA_Set_pgroup(int g_a,int p_handle)663 void GA_Set_pgroup(int g_a, int p_handle)
664 {
665 Integer aa, pp;
666 aa = (Integer)g_a;
667 pp = (Integer)p_handle;
668 wnga_set_pgroup(aa, pp);
669 }
670
NGA_Set_pgroup(int g_a,int p_handle)671 void NGA_Set_pgroup(int g_a, int p_handle)
672 {
673 Integer aa, pp;
674 aa = (Integer)g_a;
675 pp = (Integer)p_handle;
676 wnga_set_pgroup(aa, pp);
677 }
678
GA_Set_block_cyclic(int g_a,int dims[])679 void GA_Set_block_cyclic(int g_a, int dims[])
680 {
681 Integer aa, ndim;
682 Integer _ga_dims[MAXDIM];
683 aa = (Integer)g_a;
684 ndim = wnga_get_dimension(aa);
685 COPYC2F(dims,_ga_dims, ndim);
686 wnga_set_block_cyclic(aa, _ga_dims);
687 }
688
NGA_Set_block_cyclic(int g_a,int dims[])689 void NGA_Set_block_cyclic(int g_a, int dims[])
690 {
691 Integer aa, ndim;
692 Integer _ga_dims[MAXDIM];
693 aa = (Integer)g_a;
694 ndim = wnga_get_dimension(aa);
695 COPYC2F(dims,_ga_dims, ndim);
696 wnga_set_block_cyclic(aa, _ga_dims);
697 }
698
GA_Set_block_cyclic64(int g_a,int64_t dims[])699 void GA_Set_block_cyclic64(int g_a, int64_t dims[])
700 {
701 Integer aa, ndim;
702 Integer _ga_dims[MAXDIM];
703 aa = (Integer)g_a;
704 ndim = wnga_get_dimension(aa);
705 COPYC2F(dims,_ga_dims, ndim);
706 wnga_set_block_cyclic(aa, _ga_dims);
707 }
708
NGA_Set_block_cyclic64(int g_a,int64_t dims[])709 void NGA_Set_block_cyclic64(int g_a, int64_t dims[])
710 {
711 Integer aa, ndim;
712 Integer _ga_dims[MAXDIM];
713 aa = (Integer)g_a;
714 ndim = wnga_get_dimension(aa);
715 COPYC2F(dims,_ga_dims, ndim);
716 wnga_set_block_cyclic(aa, _ga_dims);
717 }
718
GA_Set_restricted(int g_a,int list[],int size)719 void GA_Set_restricted(int g_a, int list[], int size)
720 {
721 Integer aa;
722 Integer asize = (Integer)size;
723 int i;
724 Integer *_ga_map_capi;
725 aa = (Integer)g_a;
726 _ga_map_capi = (Integer*)malloc(size * sizeof(Integer));
727 for (i=0; i<size; i++)
728 _ga_map_capi[i] = (Integer)list[i];
729 wnga_set_restricted(aa,_ga_map_capi,asize);
730 free(_ga_map_capi);
731 }
732
NGA_Set_restricted(int g_a,int list[],int size)733 void NGA_Set_restricted(int g_a, int list[], int size)
734 {
735 Integer aa;
736 Integer asize = (Integer)size;
737 int i;
738 Integer *_ga_map_capi;
739 aa = (Integer)g_a;
740 _ga_map_capi = (Integer*)malloc(size * sizeof(Integer));
741 for (i=0; i<size; i++)
742 _ga_map_capi[i] = (Integer)list[i];
743 wnga_set_restricted(aa,_ga_map_capi,asize);
744 free(_ga_map_capi);
745 }
746
GA_Set_restricted_range(int g_a,int lo_proc,int hi_proc)747 void GA_Set_restricted_range(int g_a, int lo_proc, int hi_proc)
748 {
749 Integer aa, lo, hi;
750 aa = (Integer)g_a;
751 lo = (Integer)lo_proc;
752 hi = (Integer)hi_proc;
753 wnga_set_restricted_range(aa,lo,hi);
754 }
755
NGA_Set_restricted_range(int g_a,int lo_proc,int hi_proc)756 void NGA_Set_restricted_range(int g_a, int lo_proc, int hi_proc)
757 {
758 Integer aa, lo, hi;
759 aa = (Integer)g_a;
760 lo = (Integer)lo_proc;
761 hi = (Integer)hi_proc;
762 wnga_set_restricted_range(aa,lo,hi);
763 }
764
GA_Set_property(int g_a,char * property)765 void GA_Set_property(int g_a, char* property)
766 {
767 Integer aa;
768 aa = (Integer)g_a;
769 wnga_set_property(aa,property);
770 }
771
NGA_Set_property(int g_a,char * property)772 void NGA_Set_property(int g_a, char* property)
773 {
774 Integer aa;
775 aa = (Integer)g_a;
776 wnga_set_property(aa,property);
777 }
778
GA_Unset_property(int g_a)779 void GA_Unset_property(int g_a)
780 {
781 Integer aa;
782 aa = (Integer)g_a;
783 wnga_unset_property(aa);
784 }
785
NGA_Unset_property(int g_a)786 void NGA_Unset_property(int g_a)
787 {
788 Integer aa;
789 aa = (Integer)g_a;
790 wnga_unset_property(aa);
791 }
792
GA_Set_memory_dev(int g_a,char * device)793 void GA_Set_memory_dev(int g_a, char *device)
794 {
795 Integer aa;
796 aa = (Integer)g_a;
797 wnga_set_memory_dev(aa,device);
798 }
799
NGA_Set_memory_dev(int g_a,char * device)800 void NGA_Set_memory_dev(int g_a, char *device)
801 {
802 Integer aa;
803 aa = (Integer)g_a;
804 wnga_set_memory_dev(aa,device);
805 }
806
GA_Total_blocks(int g_a)807 int GA_Total_blocks(int g_a)
808 {
809 Integer aa;
810 aa = (Integer)g_a;
811 return (int)wnga_total_blocks(aa);
812 }
813
NGA_Total_blocks(int g_a)814 int NGA_Total_blocks(int g_a)
815 {
816 Integer aa;
817 aa = (Integer)g_a;
818 return (int)wnga_total_blocks(aa);
819 }
820
GA_Get_proc_index(int g_a,int iproc,int index[])821 void GA_Get_proc_index(int g_a, int iproc, int index[])
822 {
823 Integer aa, proc, ndim;
824 Integer _ga_work[MAXDIM];
825 aa = (Integer)g_a;
826 proc = (Integer)iproc;
827 ndim = wnga_get_dimension(aa);
828 wnga_get_proc_index(aa, proc, _ga_work);
829 COPYF2C(_ga_work,index, ndim);
830 }
831
NGA_Get_proc_index(int g_a,int iproc,int index[])832 void NGA_Get_proc_index(int g_a, int iproc, int index[])
833 {
834 Integer aa, proc, ndim;
835 Integer _ga_work[MAXDIM];
836 aa = (Integer)g_a;
837 proc = (Integer)iproc;
838 ndim = wnga_get_dimension(aa);
839 wnga_get_proc_index(aa, proc, _ga_work);
840 COPYF2C(_ga_work,index, ndim);
841 }
842
GA_Get_block_info(int g_a,int num_blocks[],int block_dims[])843 void GA_Get_block_info(int g_a, int num_blocks[], int block_dims[])
844 {
845 Integer aa, ndim;
846 Integer _ga_work[MAXDIM], _ga_lo[MAXDIM];
847 aa = (Integer)g_a;
848 ndim = wnga_get_dimension(aa);
849 wnga_get_block_info(aa, _ga_work, _ga_lo);
850 COPYF2C(_ga_work,num_blocks, ndim);
851 COPYF2C(_ga_lo,block_dims, ndim);
852 }
853
NGA_Get_block_info(int g_a,int num_blocks[],int block_dims[])854 void NGA_Get_block_info(int g_a, int num_blocks[], int block_dims[])
855 {
856 Integer aa, ndim;
857 Integer _ga_work[MAXDIM], _ga_lo[MAXDIM];
858 aa = (Integer)g_a;
859 ndim = wnga_get_dimension(aa);
860 wnga_get_block_info(aa, _ga_work, _ga_lo);
861 COPYF2C(_ga_work,num_blocks, ndim);
862 COPYF2C(_ga_lo,block_dims, ndim);
863 }
864
GA_Uses_proc_grid(int g_a)865 int GA_Uses_proc_grid(int g_a)
866 {
867 Integer aa = (Integer)g_a;
868 return (int)wnga_uses_proc_grid(aa);
869 }
870
NGA_Uses_proc_grid(int g_a)871 int NGA_Uses_proc_grid(int g_a)
872 {
873 Integer aa = (Integer)g_a;
874 return (int)wnga_uses_proc_grid(aa);
875 }
876
GA_Valid_handle(int g_a)877 int GA_Valid_handle(int g_a)
878 {
879 Integer aa = (Integer)g_a;
880 return (int)wnga_valid_handle(aa);
881 }
882
NGA_Valid_handle(int g_a)883 int NGA_Valid_handle(int g_a)
884 {
885 Integer aa = (Integer)g_a;
886 return (int)wnga_valid_handle(aa);
887 }
888
GA_Verify_handle(int g_a)889 int GA_Verify_handle(int g_a)
890 {
891 Integer aa = (Integer)g_a;
892 return (int)wnga_valid_handle(aa);
893 }
894
NGA_Verify_handle(int g_a)895 int NGA_Verify_handle(int g_a)
896 {
897 Integer aa = (Integer)g_a;
898 return (int)wnga_valid_handle(aa);
899 }
900
GA_Set_block_cyclic_proc_grid(int g_a,int block[],int proc_grid[])901 void GA_Set_block_cyclic_proc_grid(int g_a, int block[], int proc_grid[])
902 {
903 Integer aa, ndim;
904 Integer _ga_dims[MAXDIM];
905 Integer _ga_lo[MAXDIM];
906 aa = (Integer)g_a;
907 ndim = wnga_get_dimension(aa);
908 COPYC2F(block,_ga_dims, ndim);
909 COPYC2F(proc_grid,_ga_lo, ndim);
910 wnga_set_block_cyclic_proc_grid(aa, _ga_dims, _ga_lo);
911 }
912
NGA_Set_block_cyclic_proc_grid(int g_a,int block[],int proc_grid[])913 void NGA_Set_block_cyclic_proc_grid(int g_a, int block[], int proc_grid[])
914 {
915 Integer aa, ndim;
916 Integer _block[MAXDIM];
917 Integer _proc_grid[MAXDIM];
918 aa = (Integer)g_a;
919 ndim = wnga_get_dimension(aa);
920 COPYC2F(block,_block, ndim);
921 COPYC2F(proc_grid, _proc_grid, ndim);
922 wnga_set_block_cyclic_proc_grid(aa, _block, _proc_grid);
923 }
924
GA_Set_block_cyclic_proc_grid64(int g_a,int64_t block[],int64_t proc_grid[])925 void GA_Set_block_cyclic_proc_grid64(int g_a, int64_t block[], int64_t proc_grid[])
926 {
927 Integer aa, ndim;
928 Integer _ga_dims[MAXDIM];
929 Integer _ga_lo[MAXDIM];
930 aa = (Integer)g_a;
931 ndim = wnga_get_dimension(aa);
932 COPYC2F(block,_ga_dims, ndim);
933 COPYC2F(proc_grid,_ga_lo, ndim);
934 wnga_set_block_cyclic_proc_grid(aa, _ga_dims, _ga_lo);
935 }
936
NGA_Set_block_cyclic_proc_grid64(int g_a,int64_t block[],int64_t proc_grid[])937 void NGA_Set_block_cyclic_proc_grid64(int g_a, int64_t block[], int64_t proc_grid[])
938 {
939 Integer aa, ndim;
940 Integer _block[MAXDIM];
941 Integer _proc_grid[MAXDIM];
942 aa = (Integer)g_a;
943 ndim = wnga_get_dimension(aa);
944 COPYC2F(block,_block, ndim);
945 COPYC2F(proc_grid, _proc_grid, ndim);
946 wnga_set_block_cyclic_proc_grid(aa, _block, _proc_grid);
947 }
948
GA_Set_tiled_proc_grid(int g_a,int block[],int proc_grid[])949 void GA_Set_tiled_proc_grid(int g_a, int block[], int proc_grid[])
950 {
951 Integer aa, ndim;
952 Integer _ga_dims[MAXDIM];
953 Integer _ga_lo[MAXDIM];
954 aa = (Integer)g_a;
955 ndim = wnga_get_dimension(aa);
956 COPYC2F(block,_ga_dims, ndim);
957 COPYC2F(proc_grid,_ga_lo, ndim);
958 wnga_set_tiled_proc_grid(aa, _ga_dims, _ga_lo);
959 }
960
NGA_Set_tiled_proc_grid(int g_a,int block[],int proc_grid[])961 void NGA_Set_tiled_proc_grid(int g_a, int block[], int proc_grid[])
962 {
963 Integer aa, ndim;
964 Integer _block[MAXDIM];
965 Integer _proc_grid[MAXDIM];
966 aa = (Integer)g_a;
967 ndim = wnga_get_dimension(aa);
968 COPYC2F(block,_block, ndim);
969 COPYC2F(proc_grid, _proc_grid, ndim);
970 wnga_set_tiled_proc_grid(aa, _block, _proc_grid);
971 }
972
GA_Set_tiled_proc_grid64(int g_a,int64_t block[],int64_t proc_grid[])973 void GA_Set_tiled_proc_grid64(int g_a, int64_t block[], int64_t proc_grid[])
974 {
975 Integer aa, ndim;
976 Integer _ga_dims[MAXDIM];
977 Integer _ga_lo[MAXDIM];
978 aa = (Integer)g_a;
979 ndim = wnga_get_dimension(aa);
980 COPYC2F(block,_ga_dims, ndim);
981 COPYC2F(proc_grid,_ga_lo, ndim);
982 wnga_set_tiled_proc_grid(aa, _ga_dims, _ga_lo);
983 }
984
NGA_Set_tiled_proc_grid64(int g_a,int64_t block[],int64_t proc_grid[])985 void NGA_Set_tiled_proc_grid64(int g_a, int64_t block[], int64_t proc_grid[])
986 {
987 Integer aa, ndim;
988 Integer _block[MAXDIM];
989 Integer _proc_grid[MAXDIM];
990 aa = (Integer)g_a;
991 ndim = wnga_get_dimension(aa);
992 COPYC2F(block,_block, ndim);
993 COPYC2F(proc_grid, _proc_grid, ndim);
994 wnga_set_tiled_proc_grid(aa, _block, _proc_grid);
995 }
996
GA_Set_tiled_irreg_proc_grid(int g_a,int mapc[],int nblocks[],int proc_grid[])997 void GA_Set_tiled_irreg_proc_grid(int g_a, int mapc[], int nblocks[],
998 int proc_grid[])
999 {
1000 Integer aa, ndim;
1001 Integer *_ga_map_capi;
1002 Integer _nblocks[MAXDIM];
1003 Integer _proc_grid[MAXDIM];
1004
1005 aa = (Integer)g_a;
1006 ndim = wnga_get_dimension(aa);
1007 _ga_map_capi = copy_map(nblocks, (int)ndim, mapc);
1008 COPYC2F(nblocks,_nblocks, ndim);
1009 COPYC2F(proc_grid, _proc_grid, ndim);
1010
1011 wnga_set_tiled_irreg_proc_grid(aa, _ga_map_capi, _nblocks, _proc_grid);
1012 free(_ga_map_capi);
1013 }
1014
NGA_Set_tiled_irreg_proc_grid(int g_a,int mapc[],int nblocks[],int proc_grid[])1015 void NGA_Set_tiled_irreg_proc_grid(int g_a, int mapc[], int nblocks[],
1016 int proc_grid[])
1017 {
1018 Integer aa, ndim;
1019 Integer *_ga_map_capi;
1020 Integer _nblocks[MAXDIM];
1021 Integer _proc_grid[MAXDIM];
1022
1023 aa = (Integer)g_a;
1024 ndim = wnga_get_dimension(aa);
1025 _ga_map_capi = copy_map(nblocks, (int)ndim, mapc);
1026 COPYC2F(nblocks,_nblocks, ndim);
1027 COPYC2F(proc_grid, _proc_grid, ndim);
1028
1029 wnga_set_tiled_irreg_proc_grid(aa, _ga_map_capi, _nblocks, _proc_grid);
1030 free(_ga_map_capi);
1031 }
1032
GA_Set_tiled_irreg_proc_grid64(int g_a,int64_t mapc[],int64_t nblocks[],int64_t proc_grid[])1033 void GA_Set_tiled_irreg_proc_grid64(int g_a, int64_t mapc[], int64_t nblocks[],
1034 int64_t proc_grid[])
1035 {
1036 Integer aa, ndim;
1037 Integer *_ga_map_capi;
1038 Integer _nblocks[MAXDIM];
1039 Integer _proc_grid[MAXDIM];
1040
1041 aa = (Integer)g_a;
1042 ndim = wnga_get_dimension(aa);
1043 _ga_map_capi = copy_map64(nblocks, (int)ndim, mapc);
1044 COPYC2F(nblocks,_nblocks, ndim);
1045 COPYC2F(proc_grid, _proc_grid, ndim);
1046
1047 wnga_set_tiled_irreg_proc_grid(aa, _ga_map_capi, _nblocks, _proc_grid);
1048 free(_ga_map_capi);
1049 }
NGA_Set_tiled_irreg_proc_grid64(int g_a,int64_t mapc[],int64_t nblocks[],int64_t proc_grid[])1050 void NGA_Set_tiled_irreg_proc_grid64(int g_a, int64_t mapc[], int64_t nblocks[],
1051 int64_t proc_grid[])
1052 {
1053 Integer aa, ndim;
1054 Integer *_ga_map_capi;
1055 Integer _nblocks[MAXDIM];
1056 Integer _proc_grid[MAXDIM];
1057
1058 aa = (Integer)g_a;
1059 ndim = wnga_get_dimension(aa);
1060 _ga_map_capi = copy_map64(nblocks, (int)ndim, mapc);
1061 COPYC2F(nblocks,_nblocks, ndim);
1062 COPYC2F(proc_grid, _proc_grid, ndim);
1063
1064 wnga_set_tiled_irreg_proc_grid(aa, _ga_map_capi, _nblocks, _proc_grid);
1065 free(_ga_map_capi);
1066 }
1067
GA_Get_pgroup(int g_a)1068 int GA_Get_pgroup(int g_a)
1069 {
1070 Integer aa;
1071 aa = (Integer)g_a;
1072 return (int)wnga_get_pgroup(aa);
1073 }
1074
NGA_Get_pgroup(int g_a)1075 int NGA_Get_pgroup(int g_a)
1076 {
1077 Integer aa;
1078 aa = (Integer)g_a;
1079 return (int)wnga_get_pgroup(aa);
1080 }
1081
GA_Get_pgroup_size(int grp_id)1082 int GA_Get_pgroup_size(int grp_id)
1083 {
1084 Integer aa;
1085 aa = (Integer)grp_id;
1086 return (int)wnga_get_pgroup_size(aa);
1087 }
1088
NGA_Get_pgroup_size(int grp_id)1089 int NGA_Get_pgroup_size(int grp_id)
1090 {
1091 Integer aa;
1092 aa = (Integer)grp_id;
1093 return (int)wnga_get_pgroup_size(aa);
1094 }
1095
GA_Set_ghosts(int g_a,int width[])1096 void GA_Set_ghosts(int g_a, int width[])
1097 {
1098 Integer aa, *ptr, ndim;
1099 Integer _ga_work[MAXDIM];
1100 aa = (Integer)g_a;
1101 ndim = wnga_get_dimension(aa);
1102 if(!width)ptr=(Integer*)0;
1103 else {
1104 COPYC2F(width,_ga_work, ndim);
1105 ptr = _ga_work;
1106 }
1107 wnga_set_ghosts(aa, ptr);
1108 }
1109
GA_Set_ghosts64(int g_a,int64_t width[])1110 void GA_Set_ghosts64(int g_a, int64_t width[])
1111 {
1112 Integer aa, *ptr, ndim;
1113 Integer _ga_work[MAXDIM];
1114 aa = (Integer)g_a;
1115 ndim = wnga_get_dimension(aa);
1116 if(!width)ptr=(Integer*)0;
1117 else {
1118 COPYC2F(width,_ga_work, ndim);
1119 ptr = _ga_work;
1120 }
1121 wnga_set_ghosts(aa, ptr);
1122 }
1123
NGA_Set_ghosts(int g_a,int width[])1124 void NGA_Set_ghosts(int g_a, int width[])
1125 {
1126 Integer aa, *ptr, ndim;
1127 Integer _ga_work[MAXDIM];
1128 aa = (Integer)g_a;
1129 ndim = wnga_get_dimension(aa);
1130 if(!width)ptr=(Integer*)0;
1131 else {
1132 COPYC2F(width,_ga_work, ndim);
1133 ptr = _ga_work;
1134 }
1135 wnga_set_ghosts(aa, ptr);
1136 }
1137
NGA_Set_ghosts64(int g_a,int64_t width[])1138 void NGA_Set_ghosts64(int g_a, int64_t width[])
1139 {
1140 Integer aa, *ptr, ndim;
1141 Integer _ga_work[MAXDIM];
1142 aa = (Integer)g_a;
1143 ndim = wnga_get_dimension(aa);
1144 if(!width)ptr=(Integer*)0;
1145 else {
1146 COPYC2F(width,_ga_work, ndim);
1147 ptr = _ga_work;
1148 }
1149 wnga_set_ghosts(aa, ptr);
1150 }
1151
GA_Set_irreg_distr(int g_a,int map[],int block[])1152 void GA_Set_irreg_distr(int g_a, int map[], int block[])
1153 {
1154 Integer aa, ndim;
1155 Integer _ga_work[MAXDIM];
1156 Integer *_ga_map_capi;
1157
1158 aa = (Integer)g_a;
1159 ndim = wnga_get_dimension(aa);
1160 COPYC2F(block,_ga_work, ndim);
1161 _ga_map_capi = copy_map(block, (int)ndim, map);
1162
1163 wnga_set_irreg_distr(aa, _ga_map_capi, _ga_work);
1164 free(_ga_map_capi);
1165 }
1166
GA_Set_irreg_distr64(int g_a,int64_t map[],int64_t block[])1167 void GA_Set_irreg_distr64(int g_a, int64_t map[], int64_t block[])
1168 {
1169 Integer aa, ndim;
1170 Integer _ga_work[MAXDIM];
1171 Integer *_ga_map_capi;
1172
1173 aa = (Integer)g_a;
1174 ndim = wnga_get_dimension(aa);
1175 COPYC2F(block,_ga_work, ndim);
1176 _ga_map_capi = copy_map64(block, (int)ndim, map);
1177
1178 wnga_set_irreg_distr(aa, _ga_map_capi, _ga_work);
1179 free(_ga_map_capi);
1180 }
1181
NGA_Set_irreg_distr(int g_a,int map[],int block[])1182 void NGA_Set_irreg_distr(int g_a, int map[], int block[])
1183 {
1184 Integer aa, ndim;
1185 Integer _ga_work[MAXDIM];
1186 Integer *_ga_map_capi;
1187
1188 aa = (Integer)g_a;
1189 ndim = wnga_get_dimension(aa);
1190 COPYC2F(block,_ga_work, ndim);
1191 _ga_map_capi = copy_map(block, (int)ndim, map);
1192
1193 wnga_set_irreg_distr(aa, _ga_map_capi, _ga_work);
1194 free(_ga_map_capi);
1195 }
1196
NGA_Set_irreg_distr64(int g_a,int64_t map[],int64_t block[])1197 void NGA_Set_irreg_distr64(int g_a, int64_t map[], int64_t block[])
1198 {
1199 Integer aa, ndim;
1200 Integer _ga_work[MAXDIM];
1201 Integer *_ga_map_capi;
1202
1203 aa = (Integer)g_a;
1204 ndim = wnga_get_dimension(aa);
1205 COPYC2F(block,_ga_work, ndim);
1206 _ga_map_capi = copy_map64(block, (int)ndim, map);
1207
1208 wnga_set_irreg_distr(aa, _ga_map_capi, _ga_work);
1209 free(_ga_map_capi);
1210 }
1211
GA_Set_irreg_flag(int g_a,int flag)1212 void GA_Set_irreg_flag(int g_a, int flag)
1213 {
1214 Integer aa;
1215 logical fflag;
1216 aa = (Integer)g_a;
1217 fflag = (logical)flag;
1218 wnga_set_irreg_flag(aa, fflag);
1219 }
1220
NGA_Set_irreg_flag(int g_a,int flag)1221 void NGA_Set_irreg_flag(int g_a, int flag)
1222 {
1223 Integer aa;
1224 logical fflag;
1225 aa = (Integer)g_a;
1226 fflag = (logical)flag;
1227 wnga_set_irreg_flag(aa, fflag);
1228 }
1229
GA_Set_ghost_corner_flag(int g_a,int flag)1230 void GA_Set_ghost_corner_flag(int g_a, int flag)
1231 {
1232 Integer aa;
1233 logical fflag;
1234 aa = (Integer)g_a;
1235 fflag = (logical)flag;
1236 wnga_set_ghost_corner_flag(aa, fflag);
1237 }
1238
NGA_Set_ghost_corner_flag(int g_a,int flag)1239 void NGA_Set_ghost_corner_flag(int g_a, int flag)
1240 {
1241 Integer aa;
1242 logical fflag;
1243 aa = (Integer)g_a;
1244 fflag = (logical)flag;
1245 wnga_set_ghost_corner_flag(aa, fflag);
1246 }
1247
GA_Get_dimension(int g_a)1248 int GA_Get_dimension(int g_a)
1249 {
1250 Integer aa;
1251 aa = (Integer)g_a;
1252 return (int)wnga_get_dimension(aa);
1253 }
1254
NGA_Get_dimension(int g_a)1255 int NGA_Get_dimension(int g_a)
1256 {
1257 Integer aa;
1258 aa = (Integer)g_a;
1259 return (int)wnga_get_dimension(aa);
1260 }
1261
GA_Allocate(int g_a)1262 int GA_Allocate(int g_a)
1263 {
1264 Integer aa;
1265 aa = (Integer)g_a;
1266 return (int)wnga_allocate(aa);
1267 }
1268
NGA_Allocate(int g_a)1269 int NGA_Allocate(int g_a)
1270 {
1271 Integer aa;
1272 aa = (Integer)g_a;
1273 return (int)wnga_allocate(aa);
1274 }
1275
GA_Overlay(int g_a,int g_p)1276 int GA_Overlay(int g_a, int g_p)
1277 {
1278 Integer aa, bb;
1279 aa = (Integer)g_a;
1280 bb = (Integer)g_p;
1281 return (int)wnga_overlay(aa, bb);
1282 }
1283
NGA_Overlay(int g_a,int g_p)1284 int NGA_Overlay(int g_a, int g_p)
1285 {
1286 Integer aa, bb;
1287 aa = (Integer)g_a;
1288 bb = (Integer)g_p;
1289 return (int)wnga_overlay(aa, bb);
1290 }
1291
GA_Pgroup_nodeid(int grp_id)1292 int GA_Pgroup_nodeid(int grp_id)
1293 {
1294 Integer agrp_id = (Integer)grp_id;
1295 return (int)wnga_pgroup_nodeid(agrp_id);
1296 }
1297
NGA_Pgroup_nodeid(int grp_id)1298 int NGA_Pgroup_nodeid(int grp_id)
1299 {
1300 Integer agrp_id = (Integer)grp_id;
1301 return (int)wnga_pgroup_nodeid(agrp_id);
1302 }
1303
GA_Pgroup_nnodes(int grp_id)1304 int GA_Pgroup_nnodes(int grp_id)
1305 {
1306 Integer agrp_id = (Integer)grp_id;
1307 return (int)wnga_pgroup_nnodes(agrp_id);
1308 }
1309
NGA_Pgroup_nnodes(int grp_id)1310 int NGA_Pgroup_nnodes(int grp_id)
1311 {
1312 Integer agrp_id = (Integer)grp_id;
1313 return (int)wnga_pgroup_nnodes(agrp_id);
1314 }
1315
GA_Pgroup_create(int * list,int count)1316 int GA_Pgroup_create(int *list, int count)
1317 {
1318 Integer acount = (Integer)count;
1319 int i;
1320 int grp_id;
1321 Integer *_ga_map_capi;
1322 _ga_map_capi = (Integer*)malloc(count * sizeof(Integer));
1323 for (i=0; i<count; i++)
1324 _ga_map_capi[i] = (Integer)list[i];
1325 grp_id = (int)wnga_pgroup_create(_ga_map_capi,acount);
1326 free(_ga_map_capi);
1327 return grp_id;
1328 }
1329
NGA_Pgroup_create(int * list,int count)1330 int NGA_Pgroup_create(int *list, int count)
1331 {
1332 Integer acount = (Integer)count;
1333 int i;
1334 int grp_id;
1335 Integer *_ga_map_capi;
1336 _ga_map_capi = (Integer*)malloc(count * sizeof(Integer));
1337 for (i=0; i<count; i++)
1338 _ga_map_capi[i] = (Integer)list[i];
1339 grp_id = (int)wnga_pgroup_create(_ga_map_capi,acount);
1340 free(_ga_map_capi);
1341 return grp_id;
1342 }
1343
GA_Pgroup_duplicate(int grp)1344 int GA_Pgroup_duplicate(int grp)
1345 {
1346 Integer pgrp = (Integer)grp;
1347 return (int)wnga_pgroup_duplicate(pgrp);
1348 }
1349
NGA_Pgroup_duplicate(int grp)1350 int NGA_Pgroup_duplicate(int grp)
1351 {
1352 Integer pgrp = (Integer)grp;
1353 return (int)wnga_pgroup_duplicate(pgrp);
1354 }
1355
GA_Pgroup_self()1356 int GA_Pgroup_self()
1357 {
1358 return (int)wnga_pgroup_self();
1359 }
1360
NGA_Pgroup_self()1361 int NGA_Pgroup_self()
1362 {
1363 return (int)wnga_pgroup_self();
1364 }
1365
GA_Pgroup_destroy(int grp)1366 int GA_Pgroup_destroy(int grp)
1367 {
1368 Integer grp_id = (Integer)grp;
1369 return (int)wnga_pgroup_destroy(grp_id);
1370 }
1371
NGA_Pgroup_destroy(int grp)1372 int NGA_Pgroup_destroy(int grp)
1373 {
1374 Integer grp_id = (Integer)grp;
1375 return (int)wnga_pgroup_destroy(grp_id);
1376 }
1377
GA_Pgroup_split(int grp_id,int num_group)1378 int GA_Pgroup_split(int grp_id, int num_group)
1379 {
1380 Integer anum = (Integer)num_group;
1381 Integer grp = (Integer)grp_id;
1382 return (int)wnga_pgroup_split(grp, anum);
1383 }
1384
NGA_Pgroup_split(int grp_id,int num_group)1385 int NGA_Pgroup_split(int grp_id, int num_group)
1386 {
1387 Integer anum = (Integer)num_group;
1388 Integer grp = (Integer)grp_id;
1389 return (int)wnga_pgroup_split(grp, anum);
1390 }
1391
GA_Pgroup_split_irreg(int grp_id,int color)1392 int GA_Pgroup_split_irreg(int grp_id, int color)
1393 {
1394 Integer acolor = (Integer)color;
1395 Integer grp = (Integer)grp_id;
1396 return (int)wnga_pgroup_split_irreg(grp, acolor);
1397 }
1398
NGA_Pgroup_split_irreg(int grp_id,int color)1399 int NGA_Pgroup_split_irreg(int grp_id, int color)
1400 {
1401 Integer acolor = (Integer)color;
1402 Integer grp = (Integer)grp_id;
1403 return (int)wnga_pgroup_split_irreg(grp, acolor);
1404 }
1405
GA_Update_ghosts(int g_a)1406 void GA_Update_ghosts(int g_a)
1407 {
1408 Integer a=(Integer)g_a;
1409 wnga_update_ghosts(a);
1410 }
1411
NGA_Update_ghosts(int g_a)1412 void NGA_Update_ghosts(int g_a)
1413 {
1414 Integer a=(Integer)g_a;
1415 wnga_update_ghosts(a);
1416 }
1417
NGA_Update_ghosts_nb(int g_a,ga_nbhdl_t * nbhandle)1418 void NGA_Update_ghosts_nb(int g_a, ga_nbhdl_t *nbhandle)
1419 {
1420 Integer a=(Integer)g_a;
1421 wnga_update_ghosts_nb(a,nbhandle);
1422 }
1423
GA_Merge_mirrored(int g_a)1424 void GA_Merge_mirrored(int g_a)
1425 {
1426 Integer a=(Integer)g_a;
1427 wnga_merge_mirrored(a);
1428 }
1429
NGA_Merge_mirrored(int g_a)1430 void NGA_Merge_mirrored(int g_a)
1431 {
1432 Integer a=(Integer)g_a;
1433 wnga_merge_mirrored(a);
1434 }
1435
GA_Nblock(int g_a,int * nblock)1436 void GA_Nblock(int g_a, int *nblock)
1437 {
1438 Integer aa, ndim;
1439 Integer _ga_work[MAXDIM];
1440 aa = (Integer)g_a;
1441 wnga_nblock(aa, _ga_work);
1442 ndim = wnga_get_dimension(aa);
1443 COPYF2C(_ga_work,nblock,ndim);
1444 }
1445
NGA_Nblock(int g_a,int * nblock)1446 void NGA_Nblock(int g_a, int *nblock)
1447 {
1448 Integer aa, ndim;
1449 Integer _ga_work[MAXDIM];
1450 aa = (Integer)g_a;
1451 wnga_nblock(aa, _ga_work);
1452 ndim = wnga_get_dimension(aa);
1453 COPYF2C(_ga_work,nblock,ndim);
1454 }
1455
GA_Is_mirrored(int g_a)1456 int GA_Is_mirrored(int g_a)
1457 {
1458 Integer a=(Integer)g_a;
1459 return (int)wnga_is_mirrored(a);
1460 }
1461
NGA_Is_mirrored(int g_a)1462 int NGA_Is_mirrored(int g_a)
1463 {
1464 Integer a=(Integer)g_a;
1465 return (int)wnga_is_mirrored(a);
1466 }
1467
GA_List_nodeid(int * nlist,int nprocs)1468 void GA_List_nodeid(int *nlist, int nprocs)
1469 {
1470 Integer i, procs;
1471 Integer *list;
1472 procs = (Integer)(nprocs);
1473 list = malloc(procs*sizeof(int));
1474 wnga_list_nodeid(list, procs);
1475 for (i=0; i<procs; i++) {
1476 nlist[i] = (int)list[i];
1477 }
1478 free(list);
1479 }
1480
NGA_List_nodeid(int * nlist,int nprocs)1481 void NGA_List_nodeid(int *nlist, int nprocs)
1482 {
1483 Integer i, procs;
1484 Integer *list;
1485 procs = (Integer)(nprocs);
1486 list = malloc(procs*sizeof(int));
1487 wnga_list_nodeid(list, procs);
1488 for (i=0; i<procs; i++) {
1489 nlist[i] = (int)list[i];
1490 }
1491 free(list);
1492 }
1493
NGA_Merge_distr_patch(int g_a,int * alo,int * ahi,int g_b,int * blo,int * bhi)1494 void NGA_Merge_distr_patch(int g_a, int *alo, int *ahi,
1495 int g_b, int *blo, int *bhi)
1496 {
1497 Integer a = (Integer)g_a;
1498 Integer andim = wnga_ndim(a);
1499
1500 Integer b=(Integer)g_b;
1501 Integer bndim = wnga_ndim(b);
1502 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
1503 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
1504
1505 COPYINDEX_C2F(alo,_ga_alo, andim);
1506 COPYINDEX_C2F(ahi,_ga_ahi, andim);
1507
1508 COPYINDEX_C2F(blo,_ga_blo, bndim);
1509 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
1510
1511 wnga_merge_distr_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi);
1512 }
1513
NGA_Merge_distr_patch64(int g_a,int64_t * alo,int64_t * ahi,int g_b,int64_t * blo,int64_t * bhi)1514 void NGA_Merge_distr_patch64(int g_a, int64_t *alo, int64_t *ahi,
1515 int g_b, int64_t *blo, int64_t *bhi)
1516 {
1517 Integer a = (Integer)g_a;
1518 Integer andim = wnga_ndim(a);
1519
1520 Integer b=(Integer)g_b;
1521 Integer bndim = wnga_ndim(b);
1522 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
1523 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
1524
1525 COPYINDEX_C2F(alo,_ga_alo, andim);
1526 COPYINDEX_C2F(ahi,_ga_ahi, andim);
1527
1528 COPYINDEX_C2F(blo,_ga_blo, bndim);
1529 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
1530
1531 wnga_merge_distr_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi);
1532 }
1533
NGA_Update_ghost_dir(int g_a,int dimension,int dir,int flag)1534 int NGA_Update_ghost_dir(int g_a, int dimension, int dir, int flag)
1535 {
1536 Integer a=(Integer)g_a;
1537 Integer idim = (Integer)dimension;
1538 Integer idir = (Integer)dir;
1539 logical iflag = (logical)flag;
1540 logical st;
1541 idim++;
1542 st = wnga_update_ghost_dir(a,idim,idir,iflag);
1543 return (int)st;
1544 }
1545
NGA_NbGet_ghost_dir(int g_a,int mask[],ga_nbhdl_t * nbhandle)1546 void NGA_NbGet_ghost_dir(int g_a, int mask[], ga_nbhdl_t* nbhandle)
1547 {
1548 Integer a=(Integer)g_a;
1549 Integer ndim = wnga_ndim(a);
1550 Integer _ga_lo[MAXDIM];
1551 COPYINDEX_C2F(mask,_ga_lo, ndim);
1552 wnga_nbget_ghost_dir(a, _ga_lo,(Integer *)nbhandle);
1553 }
1554
NGA_NbGet_ghost_dir64(int g_a,int64_t mask[],ga_nbhdl_t * nbhandle)1555 void NGA_NbGet_ghost_dir64(int g_a, int64_t mask[], ga_nbhdl_t* nbhandle)
1556 {
1557 Integer a=(Integer)g_a;
1558 Integer ndim = wnga_ndim(a);
1559 Integer _ga_lo[MAXDIM];
1560 COPYINDEX_C2F(mask,_ga_lo, ndim);
1561 wnga_nbget_ghost_dir(a, _ga_lo,(Integer *)nbhandle);
1562 }
1563
GA_Has_ghosts(int g_a)1564 int GA_Has_ghosts(int g_a)
1565 {
1566 Integer a=(Integer)g_a;
1567 logical st;
1568 st = wnga_has_ghosts(a);
1569 return (int)st;
1570 }
1571
NGA_Has_ghosts(int g_a)1572 int NGA_Has_ghosts(int g_a)
1573 {
1574 Integer a=(Integer)g_a;
1575 logical st;
1576 st = wnga_has_ghosts(a);
1577 return (int)st;
1578 }
1579
NGA_Get_ghost_block(int g_a,int lo[],int hi[],void * buf,int ld[])1580 void NGA_Get_ghost_block(int g_a, int lo[], int hi[], void *buf, int ld[])
1581 {
1582 Integer a=(Integer)g_a;
1583 Integer ndim = wnga_ndim(a);
1584 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1585 Integer _ga_work[MAXDIM];
1586 COPYINDEX_C2F(lo,_ga_lo, ndim);
1587 COPYINDEX_C2F(hi,_ga_hi, ndim);
1588 COPYC2F(ld,_ga_work, ndim-1);
1589 wnga_get_ghost_block(a, _ga_lo, _ga_hi, buf, _ga_work);
1590 }
1591
NGA_Get_ghost_block64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[])1592 void NGA_Get_ghost_block64(int g_a, int64_t lo[], int64_t hi[],
1593 void *buf, int64_t ld[])
1594 {
1595 Integer a=(Integer)g_a;
1596 Integer ndim = wnga_ndim(a);
1597 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1598 Integer _ga_work[MAXDIM];
1599 COPYINDEX_C2F(lo,_ga_lo, ndim);
1600 COPYINDEX_C2F(hi,_ga_hi, ndim);
1601 COPYC2F(ld,_ga_work, ndim-1);
1602 wnga_get_ghost_block(a, _ga_lo, _ga_hi, buf, _ga_work);
1603 }
1604
GA_Mask_sync(int first,int last)1605 void GA_Mask_sync(int first, int last)
1606 {
1607 Integer ifirst = (Integer)first;
1608 Integer ilast = (Integer)last;
1609 wnga_mask_sync(ifirst,ilast);
1610 }
1611
NGA_Mask_sync(int first,int last)1612 void NGA_Mask_sync(int first, int last)
1613 {
1614 Integer ifirst = (Integer)first;
1615 Integer ilast = (Integer)last;
1616 wnga_mask_sync(ifirst,ilast);
1617 }
1618
GA_Duplicate(int g_a,char * array_name)1619 int GA_Duplicate(int g_a, char* array_name)
1620 {
1621 logical st;
1622 Integer a=(Integer)g_a, b;
1623 st = wnga_duplicate(a, &b, array_name);
1624 if(st==TRUE) return (int) b;
1625 else return 0;
1626 }
1627
NGA_Duplicate(int g_a,char * array_name)1628 int NGA_Duplicate(int g_a, char* array_name)
1629 {
1630 logical st;
1631 Integer a=(Integer)g_a, b;
1632 st = wnga_duplicate(a, &b, array_name);
1633 if(st==TRUE) return (int) b;
1634 else return 0;
1635 }
1636
GA_Destroy(int g_a)1637 void GA_Destroy(int g_a)
1638 {
1639 logical st;
1640 Integer a=(Integer)g_a;
1641 st = wnga_destroy(a);
1642 if(st==FALSE)GA_Error("GA (c) destroy failed",g_a);
1643 }
1644
NGA_Destroy(int g_a)1645 void NGA_Destroy(int g_a)
1646 {
1647 logical st;
1648 Integer a=(Integer)g_a;
1649 st = wnga_destroy(a);
1650 if(st==FALSE)GA_Error("GA (c) destroy failed",g_a);
1651 }
1652
GA_Set_memory_limit(size_t limit)1653 void GA_Set_memory_limit(size_t limit)
1654 {
1655 Integer lim = (Integer)limit;
1656 wnga_set_memory_limit(lim);
1657 }
1658
NGA_Set_memory_limit(size_t limit)1659 void NGA_Set_memory_limit(size_t limit)
1660 {
1661 Integer lim = (Integer)limit;
1662 wnga_set_memory_limit(lim);
1663 }
1664
GA_Zero(int g_a)1665 void GA_Zero(int g_a)
1666 {
1667 Integer a=(Integer)g_a;
1668 wnga_zero(a);
1669 }
1670
NGA_Zero(int g_a)1671 void NGA_Zero(int g_a)
1672 {
1673 Integer a=(Integer)g_a;
1674 wnga_zero(a);
1675 }
1676
GA_Pgroup_get_default()1677 int GA_Pgroup_get_default()
1678 {
1679 int value = (int)wnga_pgroup_get_default();
1680 return value;
1681 }
1682
NGA_Pgroup_get_default()1683 int NGA_Pgroup_get_default()
1684 {
1685 int value = (int)wnga_pgroup_get_default();
1686 return value;
1687 }
1688
GA_Pgroup_set_default(int p_handle)1689 void GA_Pgroup_set_default(int p_handle)
1690 {
1691 Integer grp = (Integer)p_handle;
1692 wnga_pgroup_set_default(grp);
1693 }
1694
NGA_Pgroup_set_default(int p_handle)1695 void NGA_Pgroup_set_default(int p_handle)
1696 {
1697 Integer grp = (Integer)p_handle;
1698 wnga_pgroup_set_default(grp);
1699 }
1700
GA_Pgroup_get_mirror()1701 int GA_Pgroup_get_mirror()
1702 {
1703 int value = (int)wnga_pgroup_get_mirror();
1704 return value;
1705 }
1706
NGA_Pgroup_get_mirror()1707 int NGA_Pgroup_get_mirror()
1708 {
1709 int value = (int)wnga_pgroup_get_mirror();
1710 return value;
1711 }
1712
GA_Pgroup_get_world()1713 int GA_Pgroup_get_world()
1714 {
1715 int value = (int)wnga_pgroup_get_world();
1716 return value;
1717 }
1718
NGA_Pgroup_get_world()1719 int NGA_Pgroup_get_world()
1720 {
1721 int value = (int)wnga_pgroup_get_world();
1722 return value;
1723 }
1724
GA_Idot(int g_a,int g_b)1725 int GA_Idot(int g_a, int g_b)
1726 {
1727 int value;
1728 Integer a=(Integer)g_a;
1729 Integer b=(Integer)g_b;
1730 wnga_dot(C_INT, a, b, &value);
1731 return value;
1732 }
1733
1734
GA_Ldot(int g_a,int g_b)1735 long GA_Ldot(int g_a, int g_b)
1736 {
1737 long value;
1738 Integer a=(Integer)g_a;
1739 Integer b=(Integer)g_b;
1740 wnga_dot(C_LONG, a, b, &value);
1741 return value;
1742 }
1743
1744
GA_Lldot(int g_a,int g_b)1745 long long GA_Lldot(int g_a, int g_b)
1746 {
1747 long long value;
1748 Integer a=(Integer)g_a;
1749 Integer b=(Integer)g_b;
1750 wnga_dot(C_LONGLONG, a, b, &value);
1751 return value;
1752 }
1753
1754
GA_Ddot(int g_a,int g_b)1755 double GA_Ddot(int g_a, int g_b)
1756 {
1757 double value;
1758 Integer a=(Integer)g_a;
1759 Integer b=(Integer)g_b;
1760 wnga_dot(C_DBL, a, b, &value);
1761 return value;
1762 }
1763
1764
GA_Zdot(int g_a,int g_b)1765 DoubleComplex GA_Zdot(int g_a, int g_b)
1766 {
1767 DoubleComplex value;
1768 Integer a=(Integer)g_a;
1769 Integer b=(Integer)g_b;
1770 wnga_dot(pnga_type_f2c(MT_F_DCPL),a,b,&value);
1771 return value;
1772 }
1773
1774
GA_Cdot(int g_a,int g_b)1775 SingleComplex GA_Cdot(int g_a, int g_b)
1776 {
1777 SingleComplex value;
1778 Integer a=(Integer)g_a;
1779 Integer b=(Integer)g_b;
1780 wnga_dot(pnga_type_f2c(MT_F_SCPL),a,b,&value);
1781 return value;
1782 }
1783
1784
GA_Fdot(int g_a,int g_b)1785 float GA_Fdot(int g_a, int g_b)
1786 {
1787 float sum;
1788 Integer a=(Integer)g_a;
1789 Integer b=(Integer)g_b;
1790 wnga_dot(C_FLOAT, a, b, &sum);
1791 return sum;
1792 }
1793
1794
GA_Randomize(int g_a,void * value)1795 void GA_Randomize(int g_a, void *value)
1796 {
1797 Integer a=(Integer)g_a;
1798 wnga_randomize(a, value);
1799 }
1800
NGA_Randomize(int g_a,void * value)1801 void NGA_Randomize(int g_a, void *value)
1802 {
1803 Integer a=(Integer)g_a;
1804 wnga_randomize(a, value);
1805 }
1806
GA_Fill(int g_a,void * value)1807 void GA_Fill(int g_a, void *value)
1808 {
1809 Integer a=(Integer)g_a;
1810 wnga_fill(a, value);
1811 }
1812
NGA_Fill(int g_a,void * value)1813 void NGA_Fill(int g_a, void *value)
1814 {
1815 Integer a=(Integer)g_a;
1816 wnga_fill(a, value);
1817 }
1818
GA_Scale(int g_a,void * value)1819 void GA_Scale(int g_a, void *value)
1820 {
1821 Integer a=(Integer)g_a;
1822 wnga_scale(a,value);
1823 }
1824
1825
GA_Add(void * alpha,int g_a,void * beta,int g_b,int g_c)1826 void GA_Add(void *alpha, int g_a, void* beta, int g_b, int g_c)
1827 {
1828 Integer a=(Integer)g_a;
1829 Integer b=(Integer)g_b;
1830 Integer c=(Integer)g_c;
1831 wnga_add(alpha, a, beta, b, c);
1832 }
1833
1834
GA_Copy(int g_a,int g_b)1835 void GA_Copy(int g_a, int g_b)
1836 {
1837 Integer a=(Integer)g_a;
1838 Integer b=(Integer)g_b;
1839 wnga_copy(a, b);
1840 }
1841
1842
NGA_Get(int g_a,int lo[],int hi[],void * buf,int ld[])1843 void NGA_Get(int g_a, int lo[], int hi[], void* buf, int ld[])
1844 {
1845 Integer a=(Integer)g_a;
1846 Integer ndim = wnga_ndim(a);
1847 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1848 Integer _ga_work[MAXDIM];
1849 COPYINDEX_C2F(lo,_ga_lo, ndim);
1850 COPYINDEX_C2F(hi,_ga_hi, ndim);
1851 COPYC2F(ld,_ga_work, ndim-1);
1852 wnga_get(a, _ga_lo, _ga_hi, buf, _ga_work);
1853 }
1854
NGA_Get64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[])1855 void NGA_Get64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[])
1856 {
1857 Integer a=(Integer)g_a;
1858 Integer ndim = wnga_ndim(a);
1859 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1860 Integer _ga_work[MAXDIM];
1861 COPYINDEX_C2F(lo,_ga_lo, ndim);
1862 COPYINDEX_C2F(hi,_ga_hi, ndim);
1863 COPYC2F(ld,_ga_work, ndim-1);
1864 wnga_get(a, _ga_lo, _ga_hi, buf, _ga_work);
1865 }
1866
NGA_NbGet(int g_a,int lo[],int hi[],void * buf,int ld[],ga_nbhdl_t * nbhandle)1867 void NGA_NbGet(int g_a, int lo[], int hi[], void* buf, int ld[],
1868 ga_nbhdl_t* nbhandle)
1869 {
1870 Integer a=(Integer)g_a;
1871 Integer ndim = wnga_ndim(a);
1872 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1873 Integer _ga_work[MAXDIM];
1874 COPYINDEX_C2F(lo,_ga_lo, ndim);
1875 COPYINDEX_C2F(hi,_ga_hi, ndim);
1876 COPYC2F(ld,_ga_work, ndim-1);
1877 wnga_nbget(a, _ga_lo, _ga_hi, buf, _ga_work,(Integer *)nbhandle);
1878 }
1879
NGA_NbGet64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[],ga_nbhdl_t * nbhandle)1880 void NGA_NbGet64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[],
1881 ga_nbhdl_t* nbhandle)
1882 {
1883 Integer a=(Integer)g_a;
1884 Integer ndim = wnga_ndim(a);
1885 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1886 Integer _ga_work[MAXDIM];
1887 COPYINDEX_C2F(lo,_ga_lo, ndim);
1888 COPYINDEX_C2F(hi,_ga_hi, ndim);
1889 COPYC2F(ld,_ga_work, ndim-1);
1890 wnga_nbget(a, _ga_lo, _ga_hi, buf, _ga_work,(Integer *)nbhandle);
1891 }
1892
NGA_Put(int g_a,int lo[],int hi[],void * buf,int ld[])1893 void NGA_Put(int g_a, int lo[], int hi[], void* buf, int ld[])
1894 {
1895 Integer a=(Integer)g_a;
1896 Integer ndim = wnga_ndim(a);
1897 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1898 Integer _ga_work[MAXDIM];
1899 COPYINDEX_C2F(lo,_ga_lo, ndim);
1900 COPYINDEX_C2F(hi,_ga_hi, ndim);
1901 COPYC2F(ld,_ga_work, ndim-1);
1902 wnga_put(a, _ga_lo, _ga_hi, buf, _ga_work);
1903 }
1904
NGA_Put64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[])1905 void NGA_Put64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[])
1906 {
1907 Integer a=(Integer)g_a;
1908 Integer ndim = wnga_ndim(a);
1909 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1910 Integer _ga_work[MAXDIM];
1911 COPYINDEX_C2F(lo,_ga_lo, ndim);
1912 COPYINDEX_C2F(hi,_ga_hi, ndim);
1913 COPYC2F(ld,_ga_work, ndim-1);
1914 wnga_put(a, _ga_lo, _ga_hi, buf, _ga_work);
1915 }
1916
NGA_NbPut(int g_a,int lo[],int hi[],void * buf,int ld[],ga_nbhdl_t * nbhandle)1917 void NGA_NbPut(int g_a, int lo[], int hi[], void* buf, int ld[],
1918 ga_nbhdl_t* nbhandle)
1919 {
1920 Integer a=(Integer)g_a;
1921 Integer ndim = wnga_ndim(a);
1922 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1923 Integer _ga_work[MAXDIM];
1924 COPYINDEX_C2F(lo,_ga_lo, ndim);
1925 COPYINDEX_C2F(hi,_ga_hi, ndim);
1926 COPYC2F(ld,_ga_work, ndim-1);
1927 wnga_nbput(a, _ga_lo, _ga_hi, buf, _ga_work,(Integer *)nbhandle);
1928 }
1929
NGA_NbPut64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[],ga_nbhdl_t * nbhandle)1930 void NGA_NbPut64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[],
1931 ga_nbhdl_t* nbhandle)
1932 {
1933 Integer a=(Integer)g_a;
1934 Integer ndim = wnga_ndim(a);
1935 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1936 Integer _ga_work[MAXDIM];
1937 COPYINDEX_C2F(lo,_ga_lo, ndim);
1938 COPYINDEX_C2F(hi,_ga_hi, ndim);
1939 COPYC2F(ld,_ga_work, ndim-1);
1940 wnga_nbput(a, _ga_lo, _ga_hi, buf, _ga_work,(Integer *)nbhandle);
1941 }
1942
NGA_NbTest(ga_nbhdl_t * nbhandle)1943 int NGA_NbTest(ga_nbhdl_t* nbhandle)
1944 {
1945 return(wnga_nbtest((Integer *)nbhandle));
1946 }
1947
NGA_NbWait(ga_nbhdl_t * nbhandle)1948 void NGA_NbWait(ga_nbhdl_t* nbhandle)
1949 {
1950 wnga_nbwait((Integer *)nbhandle);
1951 }
1952
NGA_Strided_acc(int g_a,int lo[],int hi[],int skip[],void * buf,int ld[],void * alpha)1953 void NGA_Strided_acc(int g_a, int lo[], int hi[], int skip[],
1954 void* buf, int ld[], void *alpha)
1955 {
1956 Integer a=(Integer)g_a;
1957 Integer ndim = wnga_ndim(a);
1958 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM], _ga_skip[MAXDIM];
1959 Integer _ga_work[MAXDIM];
1960 COPYINDEX_C2F(lo,_ga_lo, ndim);
1961 COPYINDEX_C2F(hi,_ga_hi, ndim);
1962 COPYC2F(ld,_ga_work, ndim-1);
1963 COPYC2F(skip, _ga_skip, ndim);
1964 wnga_strided_acc(a, _ga_lo, _ga_hi, _ga_skip, buf, _ga_work, alpha);
1965 }
1966
NGA_Strided_acc64(int g_a,int64_t lo[],int64_t hi[],int64_t skip[],void * buf,int64_t ld[],void * alpha)1967 void NGA_Strided_acc64(int g_a, int64_t lo[], int64_t hi[], int64_t skip[],
1968 void* buf, int64_t ld[], void *alpha)
1969 {
1970 Integer a=(Integer)g_a;
1971 Integer ndim = wnga_ndim(a);
1972 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1973 Integer _ga_skip[MAXDIM];
1974 Integer _ga_work[MAXDIM];
1975 COPYINDEX_C2F(lo,_ga_lo, ndim);
1976 COPYINDEX_C2F(hi,_ga_hi, ndim);
1977 COPYC2F(ld,_ga_work, ndim-1);
1978 COPYC2F(skip, _ga_skip, ndim);
1979 wnga_strided_acc(a, _ga_lo, _ga_hi, _ga_skip, buf, _ga_work, alpha);
1980 }
1981
NGA_Strided_get(int g_a,int lo[],int hi[],int skip[],void * buf,int ld[])1982 void NGA_Strided_get(int g_a, int lo[], int hi[], int skip[],
1983 void* buf, int ld[])
1984 {
1985 Integer a=(Integer)g_a;
1986 Integer ndim = wnga_ndim(a);
1987 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
1988 Integer _ga_skip[MAXDIM];
1989 Integer _ga_work[MAXDIM];
1990 COPYINDEX_C2F(lo,_ga_lo, ndim);
1991 COPYINDEX_C2F(hi,_ga_hi, ndim);
1992 COPYC2F(ld,_ga_work, ndim-1);
1993 COPYC2F(skip, _ga_skip, ndim);
1994 wnga_strided_get(a, _ga_lo, _ga_hi, _ga_skip, buf, _ga_work);
1995 }
1996
NGA_Strided_get64(int g_a,int64_t lo[],int64_t hi[],int64_t skip[],void * buf,int64_t ld[])1997 void NGA_Strided_get64(int g_a, int64_t lo[], int64_t hi[], int64_t skip[],
1998 void* buf, int64_t ld[])
1999 {
2000 Integer a=(Integer)g_a;
2001 Integer ndim = wnga_ndim(a);
2002 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2003 Integer _ga_skip[MAXDIM];
2004 Integer _ga_work[MAXDIM];
2005 COPYINDEX_C2F(lo,_ga_lo, ndim);
2006 COPYINDEX_C2F(hi,_ga_hi, ndim);
2007 COPYC2F(ld,_ga_work, ndim-1);
2008 COPYC2F(skip, _ga_skip, ndim);
2009 wnga_strided_get(a, _ga_lo, _ga_hi, _ga_skip, buf, _ga_work);
2010 }
2011
NGA_Strided_put(int g_a,int lo[],int hi[],int skip[],void * buf,int ld[])2012 void NGA_Strided_put(int g_a, int lo[], int hi[], int skip[],
2013 void* buf, int ld[])
2014 {
2015 Integer a=(Integer)g_a;
2016 Integer ndim = wnga_ndim(a);
2017 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2018 Integer _ga_skip[MAXDIM];
2019 Integer _ga_work[MAXDIM];
2020 COPYINDEX_C2F(lo,_ga_lo, ndim);
2021 COPYINDEX_C2F(hi,_ga_hi, ndim);
2022 COPYC2F(ld,_ga_work, ndim-1);
2023 COPYC2F(skip, _ga_skip, ndim);
2024 wnga_strided_put(a, _ga_lo, _ga_hi, _ga_skip, buf, _ga_work);
2025 }
2026
NGA_Strided_put64(int g_a,int64_t lo[],int64_t hi[],int64_t skip[],void * buf,int64_t ld[])2027 void NGA_Strided_put64(int g_a, int64_t lo[], int64_t hi[], int64_t skip[],
2028 void* buf, int64_t ld[])
2029 {
2030 Integer a=(Integer)g_a;
2031 Integer ndim = wnga_ndim(a);
2032 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2033 Integer _ga_skip[MAXDIM];
2034 Integer _ga_work[MAXDIM];
2035 COPYINDEX_C2F(lo,_ga_lo, ndim);
2036 COPYINDEX_C2F(hi,_ga_hi, ndim);
2037 COPYC2F(ld,_ga_work, ndim-1);
2038 COPYC2F(skip, _ga_skip, ndim);
2039 wnga_strided_put(a, _ga_lo, _ga_hi, _ga_skip, buf, _ga_work);
2040 }
2041
NGA_Acc(int g_a,int lo[],int hi[],void * buf,int ld[],void * alpha)2042 void NGA_Acc(int g_a, int lo[], int hi[], void* buf,int ld[], void* alpha)
2043 {
2044 Integer a=(Integer)g_a;
2045 Integer ndim = wnga_ndim(a);
2046 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2047 Integer _ga_work[MAXDIM];
2048 COPYINDEX_C2F(lo,_ga_lo, ndim);
2049 COPYINDEX_C2F(hi,_ga_hi, ndim);
2050 COPYC2F(ld,_ga_work, ndim-1);
2051 wnga_acc(a, _ga_lo, _ga_hi, buf, _ga_work, alpha);
2052 }
2053
NGA_Acc64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[],void * alpha)2054 void NGA_Acc64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[], void* alpha)
2055 {
2056 Integer a=(Integer)g_a;
2057 Integer ndim = wnga_ndim(a);
2058 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2059 Integer _ga_work[MAXDIM];
2060 COPYINDEX_C2F(lo,_ga_lo, ndim);
2061 COPYINDEX_C2F(hi,_ga_hi, ndim);
2062 COPYC2F(ld,_ga_work, ndim-1);
2063 wnga_acc(a, _ga_lo, _ga_hi, buf, _ga_work, alpha);
2064 }
2065
NGA_NbAcc(int g_a,int lo[],int hi[],void * buf,int ld[],void * alpha,ga_nbhdl_t * nbhandle)2066 void NGA_NbAcc(int g_a, int lo[], int hi[], void* buf,int ld[], void* alpha,
2067 ga_nbhdl_t* nbhandle)
2068 {
2069 Integer a=(Integer)g_a;
2070 Integer ndim = wnga_ndim(a);
2071 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2072 Integer _ga_work[MAXDIM];
2073 COPYINDEX_C2F(lo,_ga_lo, ndim);
2074 COPYINDEX_C2F(hi,_ga_hi, ndim);
2075 COPYC2F(ld,_ga_work, ndim-1);
2076 wnga_nbacc(a, _ga_lo,_ga_hi,buf,_ga_work,alpha,(Integer *)nbhandle);
2077 }
2078
NGA_NbAcc64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[],void * alpha,ga_nbhdl_t * nbhandle)2079 void NGA_NbAcc64(int g_a, int64_t lo[], int64_t hi[], void* buf,int64_t ld[], void* alpha,
2080 ga_nbhdl_t* nbhandle)
2081 {
2082 Integer a=(Integer)g_a;
2083 Integer ndim = wnga_ndim(a);
2084 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2085 Integer _ga_work[MAXDIM];
2086 COPYINDEX_C2F(lo,_ga_lo, ndim);
2087 COPYINDEX_C2F(hi,_ga_hi, ndim);
2088 COPYC2F(ld,_ga_work, ndim-1);
2089 wnga_nbacc(a, _ga_lo,_ga_hi,buf,_ga_work,alpha,(Integer *)nbhandle);
2090 }
2091
NGA_Periodic_get(int g_a,int lo[],int hi[],void * buf,int ld[])2092 void NGA_Periodic_get(int g_a, int lo[], int hi[], void* buf, int ld[])
2093 {
2094 Integer a=(Integer)g_a;
2095 Integer ndim = wnga_ndim(a);
2096 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2097 Integer _ga_work[MAXDIM];
2098 COPYINDEX_C2F(lo,_ga_lo, ndim);
2099 COPYINDEX_C2F(hi,_ga_hi, ndim);
2100 COPYC2F(ld,_ga_work, ndim-1);
2101 wnga_periodic(a, _ga_lo, _ga_hi, buf, _ga_work, NULL, PERIODIC_GET);
2102 }
2103
NGA_Periodic_get64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[])2104 void NGA_Periodic_get64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[])
2105 {
2106 Integer a=(Integer)g_a;
2107 Integer ndim = wnga_ndim(a);
2108 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2109 Integer _ga_work[MAXDIM];
2110 COPYINDEX_C2F(lo,_ga_lo, ndim);
2111 COPYINDEX_C2F(hi,_ga_hi, ndim);
2112 COPYC2F(ld,_ga_work, ndim-1);
2113 wnga_periodic(a, _ga_lo, _ga_hi, buf, _ga_work, NULL, PERIODIC_GET);
2114 }
2115
NGA_Periodic_put(int g_a,int lo[],int hi[],void * buf,int ld[])2116 void NGA_Periodic_put(int g_a, int lo[], int hi[], void* buf, int ld[])
2117 {
2118 Integer a=(Integer)g_a;
2119 Integer ndim = wnga_ndim(a);
2120 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2121 Integer _ga_work[MAXDIM];
2122 COPYINDEX_C2F(lo,_ga_lo, ndim);
2123 COPYINDEX_C2F(hi,_ga_hi, ndim);
2124 COPYC2F(ld,_ga_work, ndim-1);
2125 wnga_periodic(a, _ga_lo, _ga_hi, buf, _ga_work, NULL, PERIODIC_PUT);
2126 }
2127
NGA_Periodic_put64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[])2128 void NGA_Periodic_put64(int g_a, int64_t lo[], int64_t hi[], void* buf, int64_t ld[])
2129 {
2130 Integer a=(Integer)g_a;
2131 Integer ndim = wnga_ndim(a);
2132 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2133 Integer _ga_work[MAXDIM];
2134 COPYINDEX_C2F(lo,_ga_lo, ndim);
2135 COPYINDEX_C2F(hi,_ga_hi, ndim);
2136 COPYC2F(ld,_ga_work, ndim-1);
2137 wnga_periodic(a, _ga_lo, _ga_hi, buf, _ga_work, NULL, PERIODIC_PUT);
2138 }
2139
NGA_Periodic_acc(int g_a,int lo[],int hi[],void * buf,int ld[],void * alpha)2140 void NGA_Periodic_acc(int g_a, int lo[], int hi[], void* buf,int ld[], void* alpha)
2141 {
2142 Integer a=(Integer)g_a;
2143 Integer ndim = wnga_ndim(a);
2144 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2145 Integer _ga_work[MAXDIM];
2146 COPYINDEX_C2F(lo,_ga_lo, ndim);
2147 COPYINDEX_C2F(hi,_ga_hi, ndim);
2148 COPYC2F(ld,_ga_work, ndim-1);
2149 wnga_periodic(a, _ga_lo, _ga_hi, buf, _ga_work, alpha, PERIODIC_ACC);
2150 }
2151
NGA_Periodic_acc64(int g_a,int64_t lo[],int64_t hi[],void * buf,int64_t ld[],void * alpha)2152 void NGA_Periodic_acc64(int g_a, int64_t lo[], int64_t hi[], void* buf,int64_t ld[], void* alpha)
2153 {
2154 Integer a=(Integer)g_a;
2155 Integer ndim = wnga_ndim(a);
2156 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2157 Integer _ga_work[MAXDIM];
2158 COPYINDEX_C2F(lo,_ga_lo, ndim);
2159 COPYINDEX_C2F(hi,_ga_hi, ndim);
2160 COPYC2F(ld,_ga_work, ndim-1);
2161 wnga_periodic(a, _ga_lo, _ga_hi, buf, _ga_work, alpha, PERIODIC_ACC);
2162 }
2163
NGA_Read_inc(int g_a,int subscript[],long inc)2164 long NGA_Read_inc(int g_a, int subscript[], long inc)
2165 {
2166 Integer a=(Integer)g_a;
2167 Integer ndim = wnga_ndim(a);
2168 Integer in=(Integer)inc;
2169 Integer _ga_lo[MAXDIM];
2170 COPYINDEX_C2F(subscript, _ga_lo, ndim);
2171 return (long)wnga_read_inc(a, _ga_lo, in);
2172 }
2173
NGA_Read_inc64(int g_a,int64_t subscript[],long inc)2174 long NGA_Read_inc64(int g_a, int64_t subscript[], long inc)
2175 {
2176 Integer a=(Integer)g_a;
2177 Integer ndim = wnga_ndim(a);
2178 Integer in=(Integer)inc;
2179 Integer _ga_lo[MAXDIM];
2180 COPYINDEX_C2F(subscript, _ga_lo, ndim);
2181 return (long)wnga_read_inc(a, _ga_lo, in);
2182 }
2183
NGA_Distribution(int g_a,int iproc,int lo[],int hi[])2184 void NGA_Distribution(int g_a, int iproc, int lo[], int hi[])
2185 {
2186 Integer a=(Integer)g_a;
2187 Integer p=(Integer)iproc;
2188 Integer ndim = wnga_ndim(a);
2189 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2190 wnga_distribution(a, p, _ga_lo, _ga_hi);
2191 COPYINDEX_F2C(_ga_lo,lo, ndim);
2192 COPYINDEX_F2C(_ga_hi,hi, ndim);
2193 }
2194
NGA_Distribution64(int g_a,int iproc,int64_t lo[],int64_t hi[])2195 void NGA_Distribution64(int g_a, int iproc, int64_t lo[], int64_t hi[])
2196 {
2197 Integer a=(Integer)g_a;
2198 Integer p=(Integer)iproc;
2199 Integer ndim = wnga_ndim(a);
2200 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2201 wnga_distribution(a, p, _ga_lo, _ga_hi);
2202 COPYINDEX_F2C_64(_ga_lo,lo, ndim);
2203 COPYINDEX_F2C_64(_ga_hi,hi, ndim);
2204 }
2205
NGA_Select_elem(int g_a,char * op,void * val,int * index)2206 void NGA_Select_elem(int g_a, char* op, void* val, int* index)
2207 {
2208 Integer a=(Integer)g_a;
2209 Integer ndim = wnga_ndim(a);
2210 Integer _ga_lo[MAXDIM];
2211 wnga_select_elem(a, op, val, _ga_lo);
2212 COPYINDEX_F2C(_ga_lo,index,ndim);
2213 }
2214
NGA_Select_elem64(int g_a,char * op,void * val,int64_t * index)2215 void NGA_Select_elem64(int g_a, char* op, void* val, int64_t* index)
2216 {
2217 Integer a=(Integer)g_a;
2218 Integer ndim = wnga_ndim(a);
2219 Integer _ga_lo[MAXDIM];
2220 wnga_select_elem(a, op, val, _ga_lo);
2221 COPYINDEX_F2C_64(_ga_lo,index,ndim);
2222 }
2223
GA_Scan_add(int g_a,int g_b,int g_sbit,int lo,int hi,int excl)2224 void GA_Scan_add(int g_a, int g_b, int g_sbit, int lo,
2225 int hi, int excl)
2226 {
2227 Integer a = (Integer)g_a;
2228 Integer b = (Integer)g_b;
2229 Integer s = (Integer)g_sbit;
2230 Integer x = (Integer)excl;
2231 Integer alo = lo+1;
2232 Integer ahi = hi+1;
2233 wnga_scan_add(a, b, s, alo, ahi, x);
2234
2235 }
2236
GA_Scan_add64(int g_a,int g_b,int g_sbit,int64_t lo,int64_t hi,int excl)2237 void GA_Scan_add64(int g_a, int g_b, int g_sbit, int64_t lo,
2238 int64_t hi, int excl)
2239 {
2240 Integer a = (Integer)g_a;
2241 Integer b = (Integer)g_b;
2242 Integer s = (Integer)g_sbit;
2243 Integer x = (Integer)excl;
2244 Integer alo = lo+1;
2245 Integer ahi = hi+1;
2246 wnga_scan_add(a, b, s, alo, ahi, x);
2247
2248 }
2249
GA_Scan_copy(int g_a,int g_b,int g_sbit,int lo,int hi)2250 void GA_Scan_copy(int g_a, int g_b, int g_sbit, int lo,
2251 int hi)
2252 {
2253 Integer a = (Integer)g_a;
2254 Integer b = (Integer)g_b;
2255 Integer s = (Integer)g_sbit;
2256 Integer alo = lo+1;
2257 Integer ahi = hi+1;
2258 wnga_scan_copy(a, b, s, alo, ahi);
2259
2260 }
2261
GA_Scan_copy64(int g_a,int g_b,int g_sbit,int64_t lo,int64_t hi)2262 void GA_Scan_copy64(int g_a, int g_b, int g_sbit, int64_t lo,
2263 int64_t hi)
2264 {
2265 Integer a = (Integer)g_a;
2266 Integer b = (Integer)g_b;
2267 Integer s = (Integer)g_sbit;
2268 Integer alo = lo+1;
2269 Integer ahi = hi+1;
2270 wnga_scan_copy(a, b, s, alo, ahi);
2271
2272 }
2273
GA_Patch_enum(int g_a,int lo,int hi,void * start,void * inc)2274 void GA_Patch_enum(int g_a, int lo, int hi, void *start, void *inc)
2275 {
2276 Integer a = (Integer)g_a;
2277 Integer alo = lo+1;
2278 Integer ahi = hi+1;
2279 wnga_patch_enum(a, alo, ahi, start, inc);
2280 }
2281
GA_Patch_enum64(int g_a,int64_t lo,int64_t hi,void * start,void * inc)2282 void GA_Patch_enum64(int g_a, int64_t lo, int64_t hi, void *start, void *inc)
2283 {
2284 Integer a = (Integer)g_a;
2285 Integer alo = lo+1;
2286 Integer ahi = hi+1;
2287 wnga_patch_enum(a, alo, ahi, start, inc);
2288 }
2289
GA_Pack(int g_src,int g_dest,int g_mask,int lo,int hi,int * icount)2290 void GA_Pack(int g_src, int g_dest, int g_mask, int lo, int hi, int *icount)
2291 {
2292 Integer a = (Integer)g_src;
2293 Integer b = (Integer)g_dest;
2294 Integer s = (Integer)g_mask;
2295 Integer icnt;
2296 Integer alo = lo+1;
2297 Integer ahi = hi+1;
2298 wnga_pack(a, b, s, alo, ahi, &icnt);
2299 *icount = icnt;
2300 }
2301
GA_Pack64(int g_src,int g_dest,int g_mask,int64_t lo,int64_t hi,int64_t * icount)2302 void GA_Pack64(int g_src, int g_dest, int g_mask, int64_t lo, int64_t hi, int64_t *icount)
2303 {
2304 Integer a = (Integer)g_src;
2305 Integer b = (Integer)g_dest;
2306 Integer s = (Integer)g_mask;
2307 Integer icnt;
2308 Integer alo = lo+1;
2309 Integer ahi = hi+1;
2310 wnga_pack(a, b, s, alo, ahi, &icnt);
2311 *icount = icnt;
2312 }
2313
GA_Unpack(int g_src,int g_dest,int g_mask,int lo,int hi,int * icount)2314 void GA_Unpack(int g_src, int g_dest, int g_mask, int lo, int hi, int *icount)
2315 {
2316 Integer a = (Integer)g_src;
2317 Integer b = (Integer)g_dest;
2318 Integer s = (Integer)g_mask;
2319 Integer icnt;
2320 Integer alo = lo+1;
2321 Integer ahi = hi+1;
2322 wnga_unpack(a, b, s, alo, ahi, &icnt);
2323 *icount = icnt;
2324 }
2325
GA_Unpack64(int g_src,int g_dest,int g_mask,int64_t lo,int64_t hi,int64_t * icount)2326 void GA_Unpack64(int g_src, int g_dest, int g_mask, int64_t lo, int64_t hi, int64_t *icount)
2327 {
2328 Integer a = (Integer)g_src;
2329 Integer b = (Integer)g_dest;
2330 Integer s = (Integer)g_mask;
2331 Integer icnt;
2332 Integer alo = lo+1;
2333 Integer ahi = hi+1;
2334 wnga_unpack(a, b, s, alo, ahi, &icnt);
2335 *icount = icnt;
2336 }
2337
GA_Compare_distr(int g_a,int g_b)2338 int GA_Compare_distr(int g_a, int g_b)
2339 {
2340 logical st;
2341 Integer a=(Integer)g_a;
2342 Integer b=(Integer)g_b;
2343 st = wnga_compare_distr(a,b);
2344 if(st == TRUE) return 0;
2345 else return 1;
2346 }
2347
NGA_Compare_distr(int g_a,int g_b)2348 int NGA_Compare_distr(int g_a, int g_b)
2349 {
2350 logical st;
2351 Integer a=(Integer)g_a;
2352 Integer b=(Integer)g_b;
2353 st = wnga_compare_distr(a,b);
2354 if(st == TRUE) return 0;
2355 else return 1;
2356 }
2357
NGA_Access(int g_a,int lo[],int hi[],void * ptr,int ld[])2358 void NGA_Access(int g_a, int lo[], int hi[], void *ptr, int ld[])
2359 {
2360 Integer a=(Integer)g_a;
2361 Integer ndim = wnga_ndim(a);
2362 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2363 Integer _ga_work[MAXDIM];
2364 COPYINDEX_C2F(lo,_ga_lo,ndim);
2365 COPYINDEX_C2F(hi,_ga_hi,ndim);
2366
2367 wnga_access_ptr(a,_ga_lo, _ga_hi, ptr, _ga_work);
2368 COPYF2C(_ga_work,ld, ndim-1);
2369 }
2370
NGA_Access64(int g_a,int64_t lo[],int64_t hi[],void * ptr,int64_t ld[])2371 void NGA_Access64(int g_a, int64_t lo[], int64_t hi[], void *ptr, int64_t ld[])
2372 {
2373 Integer a=(Integer)g_a;
2374 Integer ndim = wnga_ndim(a);
2375 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2376 Integer _ga_work[MAXDIM];
2377 COPYINDEX_C2F(lo,_ga_lo,ndim);
2378 COPYINDEX_C2F(hi,_ga_hi,ndim);
2379
2380 wnga_access_ptr(a,_ga_lo, _ga_hi, ptr, _ga_work);
2381 COPYF2C_64(_ga_work,ld, ndim-1);
2382 }
2383
NGA_Access_block(int g_a,int idx,void * ptr,int ld[])2384 void NGA_Access_block(int g_a, int idx, void *ptr, int ld[])
2385 {
2386 Integer a=(Integer)g_a;
2387 Integer ndim = wnga_ndim(a);
2388 Integer iblock = (Integer)idx;
2389 Integer _ga_work[MAXDIM];
2390 wnga_access_block_ptr(a,iblock,ptr,_ga_work);
2391 COPYF2C(_ga_work,ld, ndim-1);
2392 }
2393
NGA_Access_block64(int g_a,int64_t idx,void * ptr,int64_t ld[])2394 void NGA_Access_block64(int g_a, int64_t idx, void *ptr, int64_t ld[])
2395 {
2396 Integer a=(Integer)g_a;
2397 Integer ndim = wnga_ndim(a);
2398 Integer iblock = (Integer)idx;
2399 Integer _ga_work[MAXDIM];
2400 wnga_access_block_ptr(a,iblock,ptr,_ga_work);
2401 COPYF2C_64(_ga_work,ld, ndim-1);
2402 }
2403
NGA_Access_block_grid(int g_a,int index[],void * ptr,int ld[])2404 void NGA_Access_block_grid(int g_a, int index[], void *ptr, int ld[])
2405 {
2406 Integer a=(Integer)g_a;
2407 Integer ndim = wnga_ndim(a);
2408 Integer _ga_work[MAXDIM], _ga_lo[MAXDIM];
2409 COPYC2F(index, _ga_lo, ndim);
2410 wnga_access_block_grid_ptr(a,_ga_lo,ptr,_ga_work);
2411 COPYF2C(_ga_work,ld, ndim-1);
2412 }
2413
NGA_Access_block_grid64(int g_a,int64_t index[],void * ptr,int64_t ld[])2414 void NGA_Access_block_grid64(int g_a, int64_t index[], void *ptr, int64_t ld[])
2415 {
2416 Integer a=(Integer)g_a;
2417 Integer ndim = wnga_ndim(a);
2418 Integer _ga_lo[MAXDIM], _ga_work[MAXDIM];
2419 COPYC2F(index, _ga_lo, ndim);
2420 wnga_access_block_grid_ptr(a,_ga_lo,ptr,_ga_work);
2421 COPYF2C_64(_ga_work,ld, ndim-1);
2422 }
2423
NGA_Access_block_segment(int g_a,int proc,void * ptr,int * len)2424 void NGA_Access_block_segment(int g_a, int proc, void *ptr, int *len)
2425 {
2426 Integer a=(Integer)g_a;
2427 Integer iblock = (Integer)proc;
2428 Integer ilen = (Integer)(*len);
2429 wnga_access_block_segment_ptr(a,iblock,ptr,&ilen);
2430 *len = (int)ilen;
2431 }
2432
NGA_Access_block_segment64(int g_a,int proc,void * ptr,int64_t * len)2433 void NGA_Access_block_segment64(int g_a, int proc, void *ptr, int64_t *len)
2434 {
2435 Integer a=(Integer)g_a;
2436 Integer iblock = (Integer)proc;
2437 Integer ilen = (Integer)(*len);
2438 wnga_access_block_segment_ptr(a,iblock,ptr,&ilen);
2439 *len = (int64_t)ilen;
2440 }
2441
NGA_Access_ghosts(int g_a,int dims[],void * ptr,int ld[])2442 void NGA_Access_ghosts(int g_a, int dims[], void *ptr, int ld[])
2443 {
2444 Integer a=(Integer)g_a;
2445 Integer ndim = wnga_ndim(a);
2446 Integer _ga_lo[MAXDIM];
2447 Integer _ga_work[MAXDIM];
2448 wnga_access_ghost_ptr(a, _ga_lo, ptr, _ga_work);
2449 COPYF2C(_ga_work,ld, ndim-1);
2450 COPYF2C(_ga_lo, dims, ndim);
2451 }
2452
NGA_Access_ghosts64(int g_a,int64_t dims[],void * ptr,int64_t ld[])2453 void NGA_Access_ghosts64(int g_a, int64_t dims[], void *ptr, int64_t ld[])
2454 {
2455 Integer a=(Integer)g_a;
2456 Integer ndim = wnga_ndim(a);
2457 Integer _ga_lo[MAXDIM];
2458 Integer _ga_work[MAXDIM];
2459
2460 wnga_access_ghost_ptr(a, _ga_lo, ptr, _ga_work);
2461 COPYF2C_64(_ga_work,ld, ndim-1);
2462 COPYF2C_64(_ga_lo, dims, ndim);
2463 }
2464
NGA_Access_ghost_element(int g_a,void * ptr,int subscript[],int ld[])2465 void NGA_Access_ghost_element(int g_a, void *ptr, int subscript[], int ld[])
2466 {
2467 Integer a=(Integer)g_a;
2468 Integer ndim = wnga_ndim(a);
2469 Integer _subscript[MAXDIM];
2470 Integer _ld[MAXDIM];
2471
2472 COPYINDEX_C2F(subscript, _subscript, ndim);
2473 COPYINDEX_C2F(ld, _ld, ndim-1);
2474 wnga_access_ghost_element_ptr(a, ptr, _subscript, _ld);
2475 }
2476
NGA_Access_ghost_element64(int g_a,void * ptr,int64_t subscript[],int64_t ld[])2477 void NGA_Access_ghost_element64(int g_a, void *ptr, int64_t subscript[], int64_t ld[])
2478 {
2479 Integer a=(Integer)g_a;
2480 Integer ndim = wnga_ndim(a);
2481 Integer _subscript[MAXDIM];
2482 Integer _ld[MAXDIM];
2483
2484 COPYINDEX_C2F(subscript, _subscript, ndim);
2485 COPYINDEX_C2F(ld, _ld, ndim-1);
2486 wnga_access_ghost_element_ptr(a, ptr, _subscript, _ld);
2487 }
2488
NGA_Release(int g_a,int lo[],int hi[])2489 void NGA_Release(int g_a, int lo[], int hi[])
2490 {
2491 Integer a=(Integer)g_a;
2492 Integer ndim = wnga_ndim(a);
2493 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2494 COPYINDEX_C2F(lo,_ga_lo,ndim);
2495 COPYINDEX_C2F(hi,_ga_hi,ndim);
2496
2497 wnga_release(a,_ga_lo, _ga_hi);
2498 }
2499
NGA_Release64(int g_a,int64_t lo[],int64_t hi[])2500 void NGA_Release64(int g_a, int64_t lo[], int64_t hi[])
2501 {
2502 Integer a=(Integer)g_a;
2503 Integer ndim = wnga_ndim(a);
2504 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2505 COPYINDEX_C2F(lo,_ga_lo,ndim);
2506 COPYINDEX_C2F(hi,_ga_hi,ndim);
2507
2508 wnga_release(a,_ga_lo, _ga_hi);
2509 }
2510
NGA_Release_block(int g_a,int idx)2511 void NGA_Release_block(int g_a, int idx)
2512 {
2513 Integer a=(Integer)g_a;
2514 Integer iblock = (Integer)idx;
2515
2516 wnga_release_block(a, iblock);
2517 }
2518
NGA_Release_block_grid(int g_a,int index[])2519 void NGA_Release_block_grid(int g_a, int index[])
2520 {
2521 Integer a=(Integer)g_a;
2522 Integer ndim = wnga_ndim(a);
2523 Integer _ga_lo[MAXDIM];
2524 COPYINDEX_C2F(index,_ga_lo,ndim);
2525
2526 wnga_release_block_grid(a, _ga_lo);
2527 }
2528
NGA_Release_block_segment(int g_a,int idx)2529 void NGA_Release_block_segment(int g_a, int idx)
2530 {
2531 Integer a=(Integer)g_a;
2532 Integer iproc = (Integer)idx;
2533
2534 wnga_release_block_segment(a, iproc);
2535 }
2536
NGA_Release_ghost_element(int g_a,int index[])2537 void NGA_Release_ghost_element(int g_a, int index[])
2538 {
2539 Integer a=(Integer)g_a;
2540 Integer ndim = wnga_ndim(a);
2541 Integer _ga_lo[MAXDIM];
2542 COPYINDEX_C2F(index,_ga_lo,ndim);
2543
2544 wnga_release_ghost_element(a, _ga_lo);
2545 }
2546
NGA_Release_ghost_element64(int g_a,int64_t index[])2547 void NGA_Release_ghost_element64(int g_a, int64_t index[])
2548 {
2549 Integer a=(Integer)g_a;
2550 Integer ndim = wnga_ndim(a);
2551 Integer _ga_lo[MAXDIM];
2552 COPYINDEX_C2F(index,_ga_lo,ndim);
2553
2554 wnga_release_ghost_element(a, _ga_lo);
2555 }
2556
2557
NGA_Release_ghosts(int g_a)2558 void NGA_Release_ghosts(int g_a)
2559 {
2560 Integer a=(Integer)g_a;
2561
2562 wnga_release_ghosts(a);
2563 }
2564
NGA_Locate(int g_a,int subscript[])2565 int NGA_Locate(int g_a, int subscript[])
2566 {
2567 logical st;
2568 Integer a=(Integer)g_a, owner;
2569 Integer ndim = wnga_ndim(a);
2570 Integer _ga_lo[MAXDIM];
2571 COPYINDEX_C2F(subscript,_ga_lo,ndim);
2572
2573 st = wnga_locate(a,_ga_lo,&owner);
2574 if(st == TRUE) return (int)owner;
2575 else return -1;
2576 }
2577
NGA_Locate64(int g_a,int64_t subscript[])2578 int NGA_Locate64(int g_a, int64_t subscript[])
2579 {
2580 logical st;
2581 Integer a=(Integer)g_a, owner;
2582 Integer ndim = wnga_ndim(a);
2583 Integer _ga_lo[MAXDIM];
2584 COPYINDEX_C2F(subscript,_ga_lo,ndim);
2585
2586 st = wnga_locate(a,_ga_lo,&owner);
2587 if(st == TRUE) return (int)owner;
2588 else return -1;
2589 }
2590
2591
NGA_Locate_nnodes(int g_a,int lo[],int hi[])2592 int NGA_Locate_nnodes(int g_a, int lo[], int hi[])
2593 {
2594 /* logical st; */
2595 Integer a=(Integer)g_a, np;
2596 Integer ndim = wnga_ndim(a);
2597 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2598
2599 COPYINDEX_C2F(lo,_ga_lo,ndim);
2600 COPYINDEX_C2F(hi,_ga_hi,ndim);
2601 /* st = wnga_locate_nnodes(a, _ga_lo, _ga_hi, &np); */
2602 (void)wnga_locate_nnodes(a, _ga_lo, _ga_hi, &np);
2603 return (int)np;
2604 }
2605
2606
NGA_Locate_nnodes64(int g_a,int64_t lo[],int64_t hi[])2607 int NGA_Locate_nnodes64(int g_a, int64_t lo[], int64_t hi[])
2608 {
2609 /* logical st; */
2610 Integer a=(Integer)g_a, np;
2611 Integer ndim = wnga_ndim(a);
2612 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2613
2614 COPYINDEX_C2F(lo,_ga_lo,ndim);
2615 COPYINDEX_C2F(hi,_ga_hi,ndim);
2616 /* st = wnga_locate_nnodes(a, _ga_lo, _ga_hi, &np); */
2617 (void)wnga_locate_nnodes(a, _ga_lo, _ga_hi, &np);
2618 return (int)np;
2619 }
2620
2621
NGA_Locate_region(int g_a,int lo[],int hi[],int map[],int procs[])2622 int NGA_Locate_region(int g_a,int lo[],int hi[],int map[],int procs[])
2623 {
2624 logical st;
2625 Integer a=(Integer)g_a, np_guess, np_actual;
2626 Integer ndim = wnga_ndim(a);
2627 Integer *tmap;
2628 int i;
2629 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2630 Integer *_ga_map_capi;
2631 COPYINDEX_C2F(lo,_ga_lo,ndim);
2632 COPYINDEX_C2F(hi,_ga_hi,ndim);
2633 st = wnga_locate_nnodes(a, _ga_lo, _ga_hi, &np_guess);
2634 tmap = (Integer *)malloc( (int)(np_guess*2*ndim *sizeof(Integer)));
2635 if(!map)GA_Error("NGA_Locate_region: unable to allocate memory",g_a);
2636 _ga_map_capi = (Integer*)malloc(np_guess*sizeof(Integer));
2637
2638 st = wnga_locate_region(a,_ga_lo, _ga_hi, tmap, _ga_map_capi, &np_actual);
2639 assert(np_guess == np_actual);
2640 if(st==FALSE){
2641 free(tmap);
2642 free(_ga_map_capi);
2643 return 0;
2644 }
2645
2646 COPY(int,_ga_map_capi,procs, np_actual);
2647
2648 /* might have to swap lo/hi when copying */
2649
2650 for(i=0; i< np_actual*2; i++){
2651 Integer *ptmap = tmap+i*ndim;
2652 int *pmap = map +i*ndim;
2653 COPYINDEX_F2C(ptmap, pmap, ndim);
2654 }
2655 free(tmap);
2656 free(_ga_map_capi);
2657 return (int)np_actual;
2658 }
2659
NGA_Locate_region64(int g_a,int64_t lo[],int64_t hi[],int64_t map[],int procs[])2660 int NGA_Locate_region64(int g_a,int64_t lo[],int64_t hi[],int64_t map[],int procs[])
2661 {
2662 logical st;
2663 Integer a=(Integer)g_a, np_guess, np_actual;
2664 Integer ndim = wnga_ndim(a);
2665 Integer *tmap;
2666 int i;
2667 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2668 Integer *_ga_map_capi;
2669 COPYINDEX_C2F(lo,_ga_lo,ndim);
2670 COPYINDEX_C2F(hi,_ga_hi,ndim);
2671 st = wnga_locate_nnodes(a, _ga_lo, _ga_hi, &np_guess);
2672 tmap = (Integer *)malloc( (int)(np_guess*2*ndim *sizeof(Integer)));
2673 if(!map)GA_Error("NGA_Locate_region: unable to allocate memory",g_a);
2674 _ga_map_capi = (Integer*)malloc(np_guess*sizeof(Integer));
2675
2676 st = wnga_locate_region(a,_ga_lo, _ga_hi, tmap, _ga_map_capi, &np_actual);
2677 assert(np_guess == np_actual);
2678 if(st==FALSE){
2679 free(tmap);
2680 free(_ga_map_capi);
2681 return 0;
2682 }
2683
2684 COPY(int,_ga_map_capi,procs, np_actual);
2685
2686 /* might have to swap lo/hi when copying */
2687
2688 for(i=0; i< np_actual*2; i++){
2689 Integer *ptmap = tmap+i*ndim;
2690 int64_t *pmap = map +i*ndim;
2691 COPYINDEX_F2C_64(ptmap, pmap, ndim);
2692 }
2693 free(tmap);
2694 free(_ga_map_capi);
2695 return (int)np_actual;
2696 }
2697
NGA_Locate_num_blocks(int g_a,int * lo,int * hi)2698 int NGA_Locate_num_blocks(int g_a, int *lo, int *hi)
2699 {
2700 Integer ret;
2701 Integer a = (Integer)g_a;
2702 Integer ndim = wnga_ndim(a);
2703 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
2704 COPYINDEX_C2F(lo,_ga_lo,ndim);
2705 COPYINDEX_C2F(hi,_ga_hi,ndim);
2706 ret = wnga_locate_num_blocks(a, _ga_lo, _ga_hi);
2707 return (int)ret;
2708 }
2709
2710
NGA_Inquire(int g_a,int * type,int * ndim,int dims[])2711 void NGA_Inquire(int g_a, int *type, int *ndim, int dims[])
2712 {
2713 Integer a=(Integer)g_a;
2714 Integer ttype, nndim;
2715 Integer _ga_dims[MAXDIM];
2716 wnga_inquire(a,&ttype, &nndim, _ga_dims);
2717 COPYF2C(_ga_dims, dims,nndim);
2718 *ndim = (int)nndim;
2719 *type = (int)ttype;
2720 }
2721
NGA_Inquire64(int g_a,int * type,int * ndim,int64_t dims[])2722 void NGA_Inquire64(int g_a, int *type, int *ndim, int64_t dims[])
2723 {
2724 Integer a=(Integer)g_a;
2725 Integer ttype, nndim;
2726 Integer _ga_dims[MAXDIM];
2727 wnga_inquire(a,&ttype, &nndim, _ga_dims);
2728 COPYF2C_64(_ga_dims, dims,nndim);
2729 *ndim = (int)nndim;
2730 *type = (int)ttype;
2731 }
2732
GA_Inquire_name(int g_a)2733 char* GA_Inquire_name(int g_a)
2734 {
2735 Integer a=(Integer)g_a;
2736 char *ptr;
2737 wnga_inquire_name(a, &ptr);
2738 return(ptr);
2739 }
2740
NGA_Inquire_name(int g_a)2741 char* NGA_Inquire_name(int g_a)
2742 {
2743 Integer a=(Integer)g_a;
2744 char *ptr;
2745 wnga_inquire_name(a, &ptr);
2746 return(ptr);
2747 }
2748
GA_Memory_avail(void)2749 size_t GA_Memory_avail(void)
2750 {
2751 return (size_t)wnga_memory_avail();
2752 }
2753
NGA_Memory_avail(void)2754 size_t NGA_Memory_avail(void)
2755 {
2756 return (size_t)wnga_memory_avail();
2757 }
2758
GA_Memory_limited(void)2759 int GA_Memory_limited(void)
2760 {
2761 if(wnga_memory_limited() ==TRUE) return 1;
2762 else return 0;
2763 }
2764
NGA_Memory_limited(void)2765 int NGA_Memory_limited(void)
2766 {
2767 if(wnga_memory_limited() ==TRUE) return 1;
2768 else return 0;
2769 }
2770
NGA_Proc_topology(int g_a,int proc,int coord[])2771 void NGA_Proc_topology(int g_a, int proc, int coord[])
2772 {
2773 Integer a=(Integer)g_a;
2774 Integer p=(Integer)proc;
2775 Integer ndim = wnga_ndim(a);
2776 Integer _ga_work[MAXDIM];
2777 wnga_proc_topology(a, p, _ga_work);
2778 COPY(int,_ga_work, coord,ndim);
2779 }
2780
GA_Get_proc_grid(int g_a,int dims[])2781 void GA_Get_proc_grid(int g_a, int dims[])
2782 {
2783 Integer a=(Integer)g_a;
2784 Integer ndim = wnga_ndim(a);
2785 Integer _ga_work[MAXDIM];
2786 wnga_get_proc_grid(a, _ga_work);
2787 COPY(int,_ga_work, dims ,ndim);
2788 }
2789
NGA_Get_proc_grid(int g_a,int dims[])2790 void NGA_Get_proc_grid(int g_a, int dims[])
2791 {
2792 Integer a=(Integer)g_a;
2793 Integer _ga_work[MAXDIM];
2794 Integer ndim = wnga_ndim(a);
2795 wnga_get_proc_grid(a, _ga_work);
2796 COPY(int,_ga_work, dims ,ndim);
2797 }
2798
GA_Check_handle(int g_a,char * string)2799 void GA_Check_handle(int g_a, char* string)
2800 {
2801 Integer a=(Integer)g_a;
2802 wnga_check_handle(a,string);
2803 }
2804
GA_Create_mutexes(int number)2805 int GA_Create_mutexes(int number)
2806 {
2807 Integer n = (Integer)number;
2808 if(wnga_create_mutexes(n) == TRUE)return 1;
2809 else return 0;
2810 }
2811
NGA_Create_mutexes(int number)2812 int NGA_Create_mutexes(int number)
2813 {
2814 Integer n = (Integer)number;
2815 if(wnga_create_mutexes(n) == TRUE)return 1;
2816 else return 0;
2817 }
2818
GA_Destroy_mutexes(void)2819 int GA_Destroy_mutexes(void) {
2820 if(wnga_destroy_mutexes() == TRUE) return 1;
2821 else return 0;
2822 }
2823
NGA_Destroy_mutexes(void)2824 int NGA_Destroy_mutexes(void) {
2825 if(wnga_destroy_mutexes() == TRUE) return 1;
2826 else return 0;
2827 }
2828
GA_Lock(int mutex)2829 void GA_Lock(int mutex)
2830 {
2831 Integer m = (Integer)mutex;
2832 wnga_lock(m);
2833 }
2834
NGA_Lock(int mutex)2835 void NGA_Lock(int mutex)
2836 {
2837 Integer m = (Integer)mutex;
2838 wnga_lock(m);
2839 }
2840
GA_Unlock(int mutex)2841 void GA_Unlock(int mutex)
2842 {
2843 Integer m = (Integer)mutex;
2844 wnga_unlock(m);
2845 }
2846
NGA_Unlock(int mutex)2847 void NGA_Unlock(int mutex)
2848 {
2849 Integer m = (Integer)mutex;
2850 wnga_unlock(m);
2851 }
2852
GA_Brdcst(void * buf,int lenbuf,int root)2853 void GA_Brdcst(void *buf, int lenbuf, int root)
2854 {
2855 Integer type=GA_TYPE_BRD;
2856 Integer len = (Integer)lenbuf;
2857 Integer orig = (Integer)root;
2858 wnga_msg_brdcst(type, buf, len, orig);
2859 }
2860
GA_Pgroup_brdcst(int grp_id,void * buf,int lenbuf,int root)2861 void GA_Pgroup_brdcst(int grp_id, void *buf, int lenbuf, int root)
2862 {
2863 Integer type=GA_TYPE_BRD;
2864 Integer len = (Integer)lenbuf;
2865 Integer orig = (Integer)root;
2866 Integer grp = (Integer)grp_id;
2867 wnga_pgroup_brdcst(grp, type, buf, len, orig);
2868 }
2869
GA_Pgroup_sync(int grp_id)2870 void GA_Pgroup_sync(int grp_id)
2871 {
2872 Integer grp = (Integer)grp_id;
2873 wnga_pgroup_sync(grp);
2874 }
2875
NGA_Pgroup_sync(int grp_id)2876 void NGA_Pgroup_sync(int grp_id)
2877 {
2878 Integer grp = (Integer)grp_id;
2879 wnga_pgroup_sync(grp);
2880 }
2881
GA_Gop(int type,void * x,int n,char * op)2882 void GA_Gop(int type, void *x, int n, char *op)
2883 { wnga_gop(type, x, n, op); }
2884
GA_Igop(int x[],int n,char * op)2885 void GA_Igop(int x[], int n, char *op)
2886 { wnga_gop(C_INT, x, n, op); }
2887
GA_Lgop(long x[],int n,char * op)2888 void GA_Lgop(long x[], int n, char *op)
2889 { wnga_gop(C_LONG, x, n, op); }
2890
GA_Llgop(long long x[],int n,char * op)2891 void GA_Llgop(long long x[], int n, char *op)
2892 { wnga_gop(C_LONGLONG, x, n, op); }
2893
GA_Fgop(float x[],int n,char * op)2894 void GA_Fgop(float x[], int n, char *op)
2895 { wnga_gop(C_FLOAT, x, n, op); }
2896
GA_Dgop(double x[],int n,char * op)2897 void GA_Dgop(double x[], int n, char *op)
2898 { wnga_gop(C_DBL, x, n, op); }
2899
GA_Cgop(SingleComplex x[],int n,char * op)2900 void GA_Cgop(SingleComplex x[], int n, char *op)
2901 { wnga_gop(C_SCPL, x, n, op); }
2902
GA_Zgop(DoubleComplex x[],int n,char * op)2903 void GA_Zgop(DoubleComplex x[], int n, char *op)
2904 { wnga_gop(C_DCPL, x, n, op); }
2905
NGA_Gop(int type,void * x,int n,char * op)2906 void NGA_Gop(int type, void *x, int n, char *op)
2907 { wnga_gop(type, x, n, op); }
2908
NGA_Igop(int x[],int n,char * op)2909 void NGA_Igop(int x[], int n, char *op)
2910 { wnga_gop(C_INT, x, n, op); }
2911
NGA_Lgop(long x[],int n,char * op)2912 void NGA_Lgop(long x[], int n, char *op)
2913 { wnga_gop(C_LONG, x, n, op); }
2914
NGA_Llgop(long long x[],int n,char * op)2915 void NGA_Llgop(long long x[], int n, char *op)
2916 { wnga_gop(C_LONGLONG, x, n, op); }
2917
NGA_Fgop(float x[],int n,char * op)2918 void NGA_Fgop(float x[], int n, char *op)
2919 { wnga_gop(C_FLOAT, x, n, op); }
2920
NGA_Dgop(double x[],int n,char * op)2921 void NGA_Dgop(double x[], int n, char *op)
2922 { wnga_gop(C_DBL, x, n, op); }
2923
NGA_Cgop(SingleComplex x[],int n,char * op)2924 void NGA_Cgop(SingleComplex x[], int n, char *op)
2925 { wnga_gop(C_SCPL, x, n, op); }
2926
NGA_Zgop(DoubleComplex x[],int n,char * op)2927 void NGA_Zgop(DoubleComplex x[], int n, char *op)
2928 { wnga_gop(C_DCPL, x, n, op); }
2929
GA_Pgroup_gop(int grp_id,int type,double x[],int n,char * op)2930 void GA_Pgroup_gop(int grp_id, int type, double x[], int n, char *op)
2931 { wnga_pgroup_gop(grp_id, type, x, n, op); }
2932
GA_Pgroup_igop(int grp_id,int x[],int n,char * op)2933 void GA_Pgroup_igop(int grp_id, int x[], int n, char *op)
2934 { wnga_pgroup_gop(grp_id, C_INT, x, n, op); }
2935
GA_Pgroup_lgop(int grp_id,long x[],int n,char * op)2936 void GA_Pgroup_lgop(int grp_id, long x[], int n, char *op)
2937 { wnga_pgroup_gop(grp_id, C_LONG, x, n, op); }
2938
GA_Pgroup_llgop(int grp_id,long long x[],int n,char * op)2939 void GA_Pgroup_llgop(int grp_id, long long x[], int n, char *op)
2940 { wnga_pgroup_gop(grp_id, C_LONGLONG, x, n, op); }
2941
GA_Pgroup_fgop(int grp_id,float x[],int n,char * op)2942 void GA_Pgroup_fgop(int grp_id, float x[], int n, char *op)
2943 { wnga_pgroup_gop(grp_id, C_FLOAT, x, n, op); }
2944
GA_Pgroup_dgop(int grp_id,double x[],int n,char * op)2945 void GA_Pgroup_dgop(int grp_id, double x[], int n, char *op)
2946 { wnga_pgroup_gop(grp_id, C_DBL, x, n, op); }
2947
GA_Pgroup_cgop(int grp_id,SingleComplex x[],int n,char * op)2948 void GA_Pgroup_cgop(int grp_id, SingleComplex x[], int n, char *op)
2949 { wnga_pgroup_gop(grp_id, C_SCPL, x, n, op); }
2950
GA_Pgroup_zgop(int grp_id,DoubleComplex x[],int n,char * op)2951 void GA_Pgroup_zgop(int grp_id, DoubleComplex x[], int n, char *op)
2952 { wnga_pgroup_gop(grp_id, C_DCPL, x, n, op); }
2953
NGA_Pgroup_gop(int grp_id,int type,double x[],int n,char * op)2954 void NGA_Pgroup_gop(int grp_id, int type, double x[], int n, char *op)
2955 { wnga_pgroup_gop(grp_id, type, x, n, op); }
2956
NGA_Pgroup_igop(int grp_id,int x[],int n,char * op)2957 void NGA_Pgroup_igop(int grp_id, int x[], int n, char *op)
2958 { wnga_pgroup_gop(grp_id, C_INT, x, n, op); }
2959
NGA_Pgroup_lgop(int grp_id,long x[],int n,char * op)2960 void NGA_Pgroup_lgop(int grp_id, long x[], int n, char *op)
2961 { wnga_pgroup_gop(grp_id, C_LONG, x, n, op); }
2962
NGA_Pgroup_llgop(int grp_id,long long x[],int n,char * op)2963 void NGA_Pgroup_llgop(int grp_id, long long x[], int n, char *op)
2964 { wnga_pgroup_gop(grp_id, C_LONGLONG, x, n, op); }
2965
NGA_Pgroup_fgop(int grp_id,float x[],int n,char * op)2966 void NGA_Pgroup_fgop(int grp_id, float x[], int n, char *op)
2967 { wnga_pgroup_gop(grp_id, C_FLOAT, x, n, op); }
2968
NGA_Pgroup_dgop(int grp_id,double x[],int n,char * op)2969 void NGA_Pgroup_dgop(int grp_id, double x[], int n, char *op)
2970 { wnga_pgroup_gop(grp_id, C_DBL, x, n, op); }
2971
NGA_Pgroup_cgop(int grp_id,SingleComplex x[],int n,char * op)2972 void NGA_Pgroup_cgop(int grp_id, SingleComplex x[], int n, char *op)
2973 { wnga_pgroup_gop(grp_id, C_SCPL, x, n, op); }
2974
NGA_Pgroup_zgop(int grp_id,DoubleComplex x[],int n,char * op)2975 void NGA_Pgroup_zgop(int grp_id, DoubleComplex x[], int n, char *op)
2976 { wnga_pgroup_gop(grp_id, C_DCPL, x, n, op); }
2977
NGA_Alloc_gatscat_buf(int nelems)2978 void NGA_Alloc_gatscat_buf(int nelems)
2979 {
2980 Integer elems = (Integer)nelems;
2981 wnga_alloc_gatscat_buf(elems);
2982 }
2983
NGA_Free_gatscat_buf()2984 void NGA_Free_gatscat_buf()
2985 {
2986 wnga_free_gatscat_buf();
2987 }
2988
NGA_Scatter(int g_a,void * v,int * subsArray[],int n)2989 void NGA_Scatter(int g_a, void *v, int* subsArray[], int n)
2990 {
2991 int idx, i;
2992 Integer a = (Integer)g_a;
2993 Integer nv = (Integer)n;
2994 #ifndef USE_GATSCAT_NEW
2995 Integer ndim = wnga_ndim(a);
2996 Integer *_subs_array;
2997 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
2998 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
2999 for(idx=0; idx<n; idx++)
3000 for(i=0; i<ndim; i++)
3001 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx][i] + 1;
3002 wnga_scatter(a, v, _subs_array, 0, nv);
3003 free(_subs_array);
3004 #else
3005 wnga_scatter(a, v, subsArray, 1, nv);
3006 #endif
3007 }
3008
NGA_Scatter_flat(int g_a,void * v,int subsArray[],int n)3009 void NGA_Scatter_flat(int g_a, void *v, int subsArray[], int n)
3010 {
3011 int idx, i;
3012 Integer a = (Integer)g_a;
3013 Integer nv = (Integer)n;
3014 Integer ndim = wnga_ndim(a);
3015 Integer *_subs_array;
3016 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3017 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3018
3019 /* adjust the indices for fortran interface */
3020 for(idx=0; idx<n; idx++)
3021 for(i=0; i<ndim; i++)
3022 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx*ndim+i] + 1;
3023
3024 wnga_scatter(a, v, _subs_array, 0, nv);
3025
3026 free(_subs_array);
3027 }
3028
3029
NGA_Scatter64(int g_a,void * v,int64_t * subsArray[],int64_t n)3030 void NGA_Scatter64(int g_a, void *v, int64_t* subsArray[], int64_t n)
3031 {
3032 int64_t idx;
3033 int i;
3034 Integer a = (Integer)g_a;
3035 Integer nv = (Integer)n;
3036 #ifndef USE_GATSCAT_NEW
3037 Integer ndim = wnga_ndim(a);
3038 Integer *_subs_array;
3039 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3040 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3041 for(idx=0; idx<n; idx++)
3042 for(i=0; i<ndim; i++)
3043 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx][i] + 1;
3044 wnga_scatter(a, v, _subs_array, 0, nv);
3045 free(_subs_array);
3046 #else
3047 wnga_scatter(a, v, subsArray, 1, nv);
3048 #endif
3049 }
3050
NGA_Scatter_flat64(int g_a,void * v,int64_t subsArray[],int64_t n)3051 void NGA_Scatter_flat64(int g_a, void *v, int64_t subsArray[], int64_t n)
3052 {
3053 int idx, i;
3054 Integer a = (Integer)g_a;
3055 Integer nv = (Integer)n;
3056 Integer ndim = wnga_ndim(a);
3057 Integer *_subs_array;
3058 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3059 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3060
3061 /* adjust the indices for fortran interface */
3062 for(idx=0; idx<n; idx++)
3063 for(i=0; i<ndim; i++)
3064 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx*ndim+i] + 1;
3065
3066 wnga_scatter(a, v, _subs_array, 0, nv);
3067
3068 free(_subs_array);
3069 }
3070
3071
NGA_Scatter_acc(int g_a,void * v,int * subsArray[],int n,void * alpha)3072 void NGA_Scatter_acc(int g_a, void *v, int* subsArray[], int n, void *alpha)
3073 {
3074 int idx, i;
3075 Integer a = (Integer)g_a;
3076 Integer nv = (Integer)n;
3077 #ifndef USE_GATSCAT_NEW
3078 Integer ndim = wnga_ndim(a);
3079 Integer *_subs_array;
3080 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3081 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3082 for(idx=0; idx<n; idx++)
3083 for(i=0; i<ndim; i++)
3084 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx][i] + 1;
3085 wnga_scatter_acc(a, v, _subs_array, 0, nv, alpha);
3086 free(_subs_array);
3087 #else
3088 wnga_scatter_acc(a, v, subsArray, 1, nv, alpha);
3089 #endif
3090 }
3091
NGA_Scatter_acc_flat(int g_a,void * v,int subsArray[],int n,void * alpha)3092 void NGA_Scatter_acc_flat(int g_a, void *v, int subsArray[], int n, void *alpha)
3093 {
3094 int idx, i;
3095 Integer a = (Integer)g_a;
3096 Integer nv = (Integer)n;
3097 Integer ndim = wnga_ndim(a);
3098 Integer *_subs_array;
3099 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3100 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3101
3102 /* adjust the indices for fortran interface */
3103 for(idx=0; idx<n; idx++)
3104 for(i=0; i<ndim; i++)
3105 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx*ndim+i] + 1;
3106
3107 wnga_scatter_acc(a, v, _subs_array, 0, nv, alpha);
3108
3109 free(_subs_array);
3110 }
3111
NGA_Scatter_acc64(int g_a,void * v,int64_t * subsArray[],int64_t n,void * alpha)3112 void NGA_Scatter_acc64(int g_a, void *v, int64_t* subsArray[], int64_t n, void *alpha)
3113 {
3114 int64_t idx;
3115 int i;
3116 Integer a = (Integer)g_a;
3117 Integer nv = (Integer)n;
3118 #ifndef USE_GATSCAT_NEW
3119 Integer ndim = wnga_ndim(a);
3120 Integer *_subs_array;
3121 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3122 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3123 for(idx=0; idx<n; idx++)
3124 for(i=0; i<ndim; i++)
3125 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx][i] + 1;
3126 wnga_scatter_acc(a, v, _subs_array, 0, nv, alpha);
3127 free(_subs_array);
3128 #else
3129 wnga_scatter_acc(a, v, subsArray, 1, nv, alpha);
3130 #endif
3131 }
3132
NGA_Scatter_acc_flat64(int g_a,void * v,int64_t subsArray[],int64_t n,void * alpha)3133 void NGA_Scatter_acc_flat64(int g_a, void *v, int64_t subsArray[], int64_t n, void *alpha)
3134 {
3135 int idx, i;
3136 Integer a = (Integer)g_a;
3137 Integer nv = (Integer)n;
3138 Integer ndim = wnga_ndim(a);
3139 Integer *_subs_array;
3140 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3141 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3142
3143 /* adjust the indices for fortran interface */
3144 for(idx=0; idx<n; idx++)
3145 for(i=0; i<ndim; i++)
3146 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx*ndim+i] + 1;
3147
3148 wnga_scatter_acc(a, v, _subs_array, 0, nv, alpha);
3149
3150 free(_subs_array);
3151 }
3152
NGA_Gather(int g_a,void * v,int * subsArray[],int n)3153 void NGA_Gather(int g_a, void *v, int* subsArray[], int n)
3154 {
3155 int idx, i;
3156 Integer a = (Integer)g_a;
3157 Integer nv = (Integer)n;
3158 #ifndef USE_GATSCAT_NEW
3159 Integer ndim = wnga_ndim(a);
3160 Integer *_subs_array;
3161 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3162 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3163
3164 /* adjust the indices for fortran interface */
3165 for(idx=0; idx<n; idx++)
3166 for(i=0; i<ndim; i++)
3167 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx][i] + 1;
3168 wnga_gather(a, v, _subs_array, 0, nv);
3169 free(_subs_array);
3170 #else
3171 wnga_gather(a, v, subsArray, 1, nv);
3172 #endif
3173 }
3174
3175
NGA_Gather_flat(int g_a,void * v,int subsArray[],int n)3176 void NGA_Gather_flat(int g_a, void *v, int subsArray[], int n)
3177 {
3178 int idx, i;
3179 Integer a = (Integer)g_a;
3180 Integer nv = (Integer)n;
3181 Integer ndim = wnga_ndim(a);
3182 Integer *_subs_array;
3183 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3184 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3185
3186 /* adjust the indices for fortran interface */
3187 for(idx=0; idx<n; idx++)
3188 for(i=0; i<ndim; i++)
3189 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx*ndim+i] + 1;
3190
3191 wnga_gather(a, v, _subs_array, 0, nv);
3192
3193 free(_subs_array);
3194 }
3195
3196
NGA_Gather64(int g_a,void * v,int64_t * subsArray[],int64_t n)3197 void NGA_Gather64(int g_a, void *v, int64_t* subsArray[], int64_t n)
3198 {
3199 int64_t idx;
3200 int i;
3201 Integer a = (Integer)g_a;
3202 Integer nv = (Integer)n;
3203 #ifndef USE_GATSCAT_NEW
3204 Integer ndim = wnga_ndim(a);
3205 Integer *_subs_array;
3206 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3207 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3208
3209 /* adjust the indices for fortran interface */
3210 for(idx=0; idx<n; idx++)
3211 for(i=0; i<ndim; i++)
3212 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx][i] + 1;
3213 wnga_gather(a, v, _subs_array, 0, nv);
3214 free(_subs_array);
3215 #else
3216 wnga_gather(a, v, subsArray, 1, nv);
3217 #endif
3218 }
3219
3220
NGA_Gather_flat64(int g_a,void * v,int64_t subsArray[],int64_t n)3221 void NGA_Gather_flat64(int g_a, void *v, int64_t subsArray[], int64_t n)
3222 {
3223 int idx, i;
3224 Integer a = (Integer)g_a;
3225 Integer nv = (Integer)n;
3226 Integer ndim = wnga_ndim(a);
3227 Integer *_subs_array;
3228 _subs_array = (Integer *)malloc((int)ndim* n * sizeof(Integer));
3229 if(_subs_array == NULL) GA_Error("Memory allocation failed.", 0);
3230
3231 /* adjust the indices for fortran interface */
3232 for(idx=0; idx<n; idx++)
3233 for(i=0; i<ndim; i++)
3234 _subs_array[idx*ndim+(ndim-i-1)] = subsArray[idx*ndim+i] + 1;
3235
3236 wnga_gather(a, v, _subs_array, 0, nv);
3237
3238 free(_subs_array);
3239 }
3240
3241
GA_Dgemm_c(char ta,char tb,int m,int n,int k,double alpha,int g_a,int g_b,double beta,int g_c)3242 void GA_Dgemm_c(char ta, char tb, int m, int n, int k,
3243 double alpha, int g_a, int g_b, double beta, int g_c )
3244 {
3245 Integer G_a = g_a;
3246 Integer G_b = g_b;
3247 Integer G_c = g_c;
3248
3249 Integer ailo = 1;
3250 Integer aihi = m;
3251 Integer ajlo = 1;
3252 Integer ajhi = k;
3253
3254 Integer bilo = 1;
3255 Integer bihi = k;
3256 Integer bjlo = 1;
3257 Integer bjhi = n;
3258
3259 Integer cilo = 1;
3260 Integer cihi = m;
3261 Integer cjlo = 1;
3262 Integer cjhi = n;
3263
3264 pnga_matmul(&ta, &tb, (DoublePrecision *)&alpha,(DoublePrecision *)&beta,
3265 G_a, ailo, aihi, ajlo, ajhi,
3266 G_b, bilo, bihi, bjlo, bjhi,
3267 G_c, cilo, cihi, cjlo, cjhi);
3268 }
3269
GA_Zgemm_c(char ta,char tb,int m,int n,int k,DoubleComplex alpha,int g_a,int g_b,DoubleComplex beta,int g_c)3270 void GA_Zgemm_c(char ta, char tb, int m, int n, int k,
3271 DoubleComplex alpha, int g_a, int g_b,
3272 DoubleComplex beta, int g_c )
3273 {
3274 Integer G_a = g_a;
3275 Integer G_b = g_b;
3276 Integer G_c = g_c;
3277
3278 Integer ailo = 1;
3279 Integer aihi = m;
3280 Integer ajlo = 1;
3281 Integer ajhi = k;
3282
3283 Integer bilo = 1;
3284 Integer bihi = k;
3285 Integer bjlo = 1;
3286 Integer bjhi = n;
3287
3288 Integer cilo = 1;
3289 Integer cihi = m;
3290 Integer cjlo = 1;
3291 Integer cjhi = n;
3292
3293 pnga_matmul(&ta, &tb, (DoublePrecision *)&alpha,(DoublePrecision *)&beta,
3294 G_a, ailo, aihi, ajlo, ajhi,
3295 G_b, bilo, bihi, bjlo, bjhi,
3296 G_c, cilo, cihi, cjlo, cjhi);
3297 }
3298
GA_Cgemm_c(char ta,char tb,int m,int n,int k,SingleComplex alpha,int g_a,int g_b,SingleComplex beta,int g_c)3299 void GA_Cgemm_c(char ta, char tb, int m, int n, int k,
3300 SingleComplex alpha, int g_a, int g_b,
3301 SingleComplex beta, int g_c )
3302 {
3303 Integer G_a = g_a;
3304 Integer G_b = g_b;
3305 Integer G_c = g_c;
3306
3307 Integer ailo = 1;
3308 Integer aihi = m;
3309 Integer ajlo = 1;
3310 Integer ajhi = k;
3311
3312 Integer bilo = 1;
3313 Integer bihi = k;
3314 Integer bjlo = 1;
3315 Integer bjhi = n;
3316
3317 Integer cilo = 1;
3318 Integer cihi = m;
3319 Integer cjlo = 1;
3320 Integer cjhi = n;
3321
3322 pnga_matmul(&ta, &tb, (float *)&alpha,(float *)&beta,
3323 G_a, ailo, aihi, ajlo, ajhi,
3324 G_b, bilo, bihi, bjlo, bjhi,
3325 G_c, cilo, cihi, cjlo, cjhi);
3326 }
3327
GA_Sgemm_c(char ta,char tb,int m,int n,int k,float alpha,int g_a,int g_b,float beta,int g_c)3328 void GA_Sgemm_c(char ta, char tb, int m, int n, int k,
3329 float alpha, int g_a, int g_b,
3330 float beta, int g_c )
3331 {
3332 Integer G_a = g_a;
3333 Integer G_b = g_b;
3334 Integer G_c = g_c;
3335
3336 Integer ailo = 1;
3337 Integer aihi = m;
3338 Integer ajlo = 1;
3339 Integer ajhi = k;
3340
3341 Integer bilo = 1;
3342 Integer bihi = k;
3343 Integer bjlo = 1;
3344 Integer bjhi = n;
3345
3346 Integer cilo = 1;
3347 Integer cihi = m;
3348 Integer cjlo = 1;
3349 Integer cjhi = n;
3350
3351 pnga_matmul(&ta, &tb, (float*)&alpha, (float*)&beta,
3352 G_a, ailo, aihi, ajlo, ajhi,
3353 G_b, bilo, bihi, bjlo, bjhi,
3354 G_c, cilo, cihi, cjlo, cjhi);
3355 }
3356
GA_Dgemm64_c(char ta,char tb,int64_t m,int64_t n,int64_t k,double alpha,int g_a,int g_b,double beta,int g_c)3357 void GA_Dgemm64_c(char ta, char tb, int64_t m, int64_t n, int64_t k,
3358 double alpha, int g_a, int g_b, double beta, int g_c )
3359 {
3360 Integer G_a = g_a;
3361 Integer G_b = g_b;
3362 Integer G_c = g_c;
3363
3364 Integer ailo = 1;
3365 Integer aihi = m;
3366 Integer ajlo = 1;
3367 Integer ajhi = k;
3368
3369 Integer bilo = 1;
3370 Integer bihi = k;
3371 Integer bjlo = 1;
3372 Integer bjhi = n;
3373
3374 Integer cilo = 1;
3375 Integer cihi = m;
3376 Integer cjlo = 1;
3377 Integer cjhi = n;
3378
3379 pnga_matmul(&ta, &tb, (DoublePrecision *)&alpha,(DoublePrecision *)&beta,
3380 G_a, ailo, aihi, ajlo, ajhi,
3381 G_b, bilo, bihi, bjlo, bjhi,
3382 G_c, cilo, cihi, cjlo, cjhi);
3383 }
3384
GA_Zgemm64_c(char ta,char tb,int64_t m,int64_t n,int64_t k,DoubleComplex alpha,int g_a,int g_b,DoubleComplex beta,int g_c)3385 void GA_Zgemm64_c(char ta, char tb, int64_t m, int64_t n, int64_t k,
3386 DoubleComplex alpha, int g_a, int g_b,
3387 DoubleComplex beta, int g_c )
3388 {
3389 Integer G_a = g_a;
3390 Integer G_b = g_b;
3391 Integer G_c = g_c;
3392
3393 Integer ailo = 1;
3394 Integer aihi = m;
3395 Integer ajlo = 1;
3396 Integer ajhi = k;
3397
3398 Integer bilo = 1;
3399 Integer bihi = k;
3400 Integer bjlo = 1;
3401 Integer bjhi = n;
3402
3403 Integer cilo = 1;
3404 Integer cihi = m;
3405 Integer cjlo = 1;
3406 Integer cjhi = n;
3407
3408 pnga_matmul(&ta, &tb, (DoublePrecision *)&alpha,(DoublePrecision *)&beta,
3409 G_a, ailo, aihi, ajlo, ajhi,
3410 G_b, bilo, bihi, bjlo, bjhi,
3411 G_c, cilo, cihi, cjlo, cjhi);
3412 }
3413
GA_Cgemm64_c(char ta,char tb,int64_t m,int64_t n,int64_t k,SingleComplex alpha,int g_a,int g_b,SingleComplex beta,int g_c)3414 void GA_Cgemm64_c(char ta, char tb, int64_t m, int64_t n, int64_t k,
3415 SingleComplex alpha, int g_a, int g_b,
3416 SingleComplex beta, int g_c )
3417 {
3418 Integer G_a = g_a;
3419 Integer G_b = g_b;
3420 Integer G_c = g_c;
3421
3422 Integer ailo = 1;
3423 Integer aihi = m;
3424 Integer ajlo = 1;
3425 Integer ajhi = k;
3426
3427 Integer bilo = 1;
3428 Integer bihi = k;
3429 Integer bjlo = 1;
3430 Integer bjhi = n;
3431
3432 Integer cilo = 1;
3433 Integer cihi = m;
3434 Integer cjlo = 1;
3435 Integer cjhi = n;
3436
3437 pnga_matmul(&ta, &tb, (float *)&alpha,(float *)&beta,
3438 G_a, ailo, aihi, ajlo, ajhi,
3439 G_b, bilo, bihi, bjlo, bjhi,
3440 G_c, cilo, cihi, cjlo, cjhi);
3441 }
3442
GA_Sgemm64_c(char ta,char tb,int64_t m,int64_t n,int64_t k,float alpha,int g_a,int g_b,float beta,int g_c)3443 void GA_Sgemm64_c(char ta, char tb, int64_t m, int64_t n, int64_t k,
3444 float alpha, int g_a, int g_b,
3445 float beta, int g_c )
3446 {
3447 Integer G_a = g_a;
3448 Integer G_b = g_b;
3449 Integer G_c = g_c;
3450
3451 Integer ailo = 1;
3452 Integer aihi = m;
3453 Integer ajlo = 1;
3454 Integer ajhi = k;
3455
3456 Integer bilo = 1;
3457 Integer bihi = k;
3458 Integer bjlo = 1;
3459 Integer bjhi = n;
3460
3461 Integer cilo = 1;
3462 Integer cihi = m;
3463 Integer cjlo = 1;
3464 Integer cjhi = n;
3465
3466 pnga_matmul(&ta, &tb, (float*)&alpha, (float*)&beta,
3467 G_a, ailo, aihi, ajlo, ajhi,
3468 G_b, bilo, bihi, bjlo, bjhi,
3469 G_c, cilo, cihi, cjlo, cjhi);
3470 }
3471
3472 /**
3473 * When calling GA _dgemm from the C, it is represented as follows (since the
3474 * underlying GA dgemm implementation pnga_matmul is in Fortran style)
3475 * C(m,n) = A(m,k) * B(k,n)
3476 * Since GA internally creates GAs in Fortran style, we remap the above
3477 * expression to: C(n,m) = B(n,k) * A(k,m) and pass it to fortran. This
3478 * produces the output C in (n,m) format, which translates to C as (m,n),and
3479 * ultimately giving us the correct result.
3480 */
GA_Dgemm(char ta,char tb,int m,int n,int k,double alpha,int g_a,int g_b,double beta,int g_c)3481 void GA_Dgemm(char ta, char tb, int m, int n, int k,
3482 double alpha, int g_a, int g_b, double beta, int g_c )
3483 {
3484 GA_Dgemm_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3485 }
3486
GA_Zgemm(char ta,char tb,int m,int n,int k,DoubleComplex alpha,int g_a,int g_b,DoubleComplex beta,int g_c)3487 void GA_Zgemm(char ta, char tb, int m, int n, int k,
3488 DoubleComplex alpha, int g_a, int g_b,
3489 DoubleComplex beta, int g_c )
3490 {
3491 GA_Zgemm_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3492 }
3493
GA_Cgemm(char ta,char tb,int m,int n,int k,SingleComplex alpha,int g_a,int g_b,SingleComplex beta,int g_c)3494 void GA_Cgemm(char ta, char tb, int m, int n, int k,
3495 SingleComplex alpha, int g_a, int g_b,
3496 SingleComplex beta, int g_c )
3497 {
3498 GA_Cgemm_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3499 }
3500
GA_Sgemm(char ta,char tb,int m,int n,int k,float alpha,int g_a,int g_b,float beta,int g_c)3501 void GA_Sgemm(char ta, char tb, int m, int n, int k,
3502 float alpha, int g_a, int g_b,
3503 float beta, int g_c )
3504 {
3505 GA_Sgemm_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3506 }
3507
GA_Dgemm64(char ta,char tb,int64_t m,int64_t n,int64_t k,double alpha,int g_a,int g_b,double beta,int g_c)3508 void GA_Dgemm64(char ta, char tb, int64_t m, int64_t n, int64_t k,
3509 double alpha, int g_a, int g_b, double beta, int g_c )
3510 {
3511 GA_Dgemm64_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3512 }
3513
GA_Zgemm64(char ta,char tb,int64_t m,int64_t n,int64_t k,DoubleComplex alpha,int g_a,int g_b,DoubleComplex beta,int g_c)3514 void GA_Zgemm64(char ta, char tb, int64_t m, int64_t n, int64_t k,
3515 DoubleComplex alpha, int g_a, int g_b,
3516 DoubleComplex beta, int g_c )
3517 {
3518 GA_Zgemm64_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3519 }
3520
GA_Cgemm64(char ta,char tb,int64_t m,int64_t n,int64_t k,SingleComplex alpha,int g_a,int g_b,SingleComplex beta,int g_c)3521 void GA_Cgemm64(char ta, char tb, int64_t m, int64_t n, int64_t k,
3522 SingleComplex alpha, int g_a, int g_b,
3523 SingleComplex beta, int g_c )
3524 {
3525 GA_Cgemm64_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3526 }
3527
GA_Sgemm64(char ta,char tb,int64_t m,int64_t n,int64_t k,float alpha,int g_a,int g_b,float beta,int g_c)3528 void GA_Sgemm64(char ta, char tb, int64_t m, int64_t n, int64_t k,
3529 float alpha, int g_a, int g_b,
3530 float beta, int g_c )
3531 {
3532 GA_Sgemm64_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
3533 }
3534
3535 /* Patch related */
3536
NGA_Copy_patch(char trans,int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[])3537 void NGA_Copy_patch(char trans, int g_a, int alo[], int ahi[],
3538 int g_b, int blo[], int bhi[])
3539 {
3540 Integer a=(Integer)g_a;
3541 Integer andim = wnga_ndim(a);
3542
3543 Integer b=(Integer)g_b;
3544 Integer bndim = wnga_ndim(b);
3545
3546 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3547 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3548 COPYINDEX_C2F(alo,_ga_alo, andim);
3549 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3550
3551 COPYINDEX_C2F(blo,_ga_blo, bndim);
3552 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3553
3554 wnga_copy_patch(&trans, a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi);
3555 }
3556
NGA_Copy_patch64(char trans,int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[])3557 void NGA_Copy_patch64(char trans, int g_a, int64_t alo[], int64_t ahi[],
3558 int g_b, int64_t blo[], int64_t bhi[])
3559 {
3560 Integer a=(Integer)g_a;
3561 Integer andim = wnga_ndim(a);
3562
3563 Integer b=(Integer)g_b;
3564 Integer bndim = wnga_ndim(b);
3565
3566 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3567 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3568 COPYINDEX_C2F(alo,_ga_alo, andim);
3569 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3570
3571 COPYINDEX_C2F(blo,_ga_blo, bndim);
3572 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3573
3574 wnga_copy_patch(&trans, a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi);
3575 }
3576
GA_Matmul_patch(char transa,char transb,void * alpha,void * beta,int g_a,int ailo,int aihi,int ajlo,int ajhi,int g_b,int bilo,int bihi,int bjlo,int bjhi,int g_c,int cilo,int cihi,int cjlo,int cjhi)3577 void GA_Matmul_patch(char transa, char transb, void* alpha, void *beta,
3578 int g_a, int ailo, int aihi, int ajlo, int ajhi,
3579 int g_b, int bilo, int bihi, int bjlo, int bjhi,
3580 int g_c, int cilo, int cihi, int cjlo, int cjhi)
3581
3582 {
3583 Integer Ig_a = g_a;
3584 Integer Ig_b = g_b;
3585 Integer Ig_c = g_c;
3586 #if 0
3587 Integer alo[2], ahi[2];
3588 Integer blo[2], bhi[2];
3589 Integer clo[2], chi[2];
3590 alo[0]=ailo+1; ahi[0]=aihi+1; alo[1]=ajlo+1; ahi[1]=ajhi+1;
3591 blo[0]=bilo+1; bhi[0]=bihi+1; blo[1]=bjlo+1; bhi[1]=bjhi+1;
3592 clo[0]=cilo+1; chi[0]=cihi+1; clo[1]=cjlo+1; chi[1]=cjhi+1;
3593 pnga_matmul_patch(transa, transb, alpha, beta, g_a, alo, ahi,
3594 g_b, blo, bhi, g_c, clo, chi);
3595 #else
3596 Integer Iailo=ailo+1, Iaihi=aihi+1, Iajlo=ajlo+1, Iajhi=ajhi+1;
3597 Integer Ibilo=bilo+1, Ibihi=bihi+1, Ibjlo=bjlo+1, Ibjhi=bjhi+1;
3598 Integer Icilo=cilo+1, Icihi=cihi+1, Icjlo=cjlo+1, Icjhi=cjhi+1;
3599 if(pnga_is_mirrored(Ig_a))
3600 wnga_matmul_mirrored(&transa, &transb, (void*)alpha, (void*)beta,
3601 Ig_a, Iailo, Iaihi, Iajlo, Iajhi,
3602 Ig_b, Ibilo, Ibihi, Ibjlo, Ibjhi,
3603 Ig_c, Icilo, Icihi, Icjlo, Icjhi);
3604 else {
3605 gai_matmul_patch_flag(SET);
3606 wnga_matmul(&transa, &transb, (void*)alpha, (void*)beta,
3607 Ig_a, Iailo, Iaihi, Iajlo, Iajhi,
3608 Ig_b, Ibilo, Ibihi, Ibjlo, Ibjhi,
3609 Ig_c, Icilo, Icihi, Icjlo, Icjhi);
3610 gai_matmul_patch_flag(UNSET);
3611 }
3612 #endif
3613 }
3614
GA_Matmul_patch64(char transa,char transb,void * alpha,void * beta,int g_a,int64_t ailo,int64_t aihi,int64_t ajlo,int64_t ajhi,int g_b,int64_t bilo,int64_t bihi,int64_t bjlo,int64_t bjhi,int g_c,int64_t cilo,int64_t cihi,int64_t cjlo,int64_t cjhi)3615 void GA_Matmul_patch64(char transa, char transb, void* alpha, void *beta,
3616 int g_a, int64_t ailo, int64_t aihi, int64_t ajlo, int64_t ajhi,
3617 int g_b, int64_t bilo, int64_t bihi, int64_t bjlo, int64_t bjhi,
3618 int g_c, int64_t cilo, int64_t cihi, int64_t cjlo, int64_t cjhi)
3619
3620 {
3621 Integer Ig_a = g_a;
3622 Integer Ig_b = g_b;
3623 Integer Ig_c = g_c;
3624 #if 0
3625 Integer alo[2], ahi[2];
3626 Integer blo[2], bhi[2];
3627 Integer clo[2], chi[2];
3628 alo[0]=ailo+1; ahi[0]=aihi+1; alo[1]=ajlo+1; ahi[1]=ajhi+1;
3629 blo[0]=bilo+1; bhi[0]=bihi+1; blo[1]=bjlo+1; bhi[1]=bjhi+1;
3630 clo[0]=cilo+1; chi[0]=cihi+1; clo[1]=cjlo+1; chi[1]=cjhi+1;
3631 pnga_matmul_patch(transa, transb, alpha, beta, g_a, alo, ahi,
3632 g_b, blo, bhi, g_c, clo, chi);
3633 #else
3634 Integer Iailo=ailo+1, Iaihi=aihi+1, Iajlo=ajlo+1, Iajhi=ajhi+1;
3635 Integer Ibilo=bilo+1, Ibihi=bihi+1, Ibjlo=bjlo+1, Ibjhi=bjhi+1;
3636 Integer Icilo=cilo+1, Icihi=cihi+1, Icjlo=cjlo+1, Icjhi=cjhi+1;
3637 if(pnga_is_mirrored(Ig_a))
3638 wnga_matmul_mirrored(&transa, &transb, (void*)alpha, (void*)beta,
3639 Ig_a, Iailo, Iaihi, Iajlo, Iajhi,
3640 Ig_b, Ibilo, Ibihi, Ibjlo, Ibjhi,
3641 Ig_c, Icilo, Icihi, Icjlo, Icjhi);
3642 else {
3643 gai_matmul_patch_flag(SET);
3644 wnga_matmul(&transa, &transb, (void*)alpha, (void*)beta,
3645 Ig_a, Iailo, Iaihi, Iajlo, Iajhi,
3646 Ig_b, Ibilo, Ibihi, Ibjlo, Ibjhi,
3647 Ig_c, Icilo, Icihi, Icjlo, Icjhi);
3648 gai_matmul_patch_flag(UNSET);
3649 }
3650 #endif
3651 }
3652
NGA_Matmul_patch(char transa,char transb,void * alpha,void * beta,int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])3653 void NGA_Matmul_patch(char transa, char transb, void* alpha, void *beta,
3654 int g_a, int alo[], int ahi[],
3655 int g_b, int blo[], int bhi[],
3656 int g_c, int clo[], int chi[])
3657
3658 {
3659 Integer a=(Integer)g_a;
3660 Integer andim = wnga_ndim(a);
3661
3662 Integer b=(Integer)g_b;
3663 Integer bndim = wnga_ndim(b);
3664
3665 Integer c=(Integer)g_c;
3666 Integer cndim = wnga_ndim(c);
3667
3668 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3669 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3670 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
3671 COPYINDEX_C2F(alo,_ga_alo, andim);
3672 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3673
3674 COPYINDEX_C2F(blo,_ga_blo, bndim);
3675 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3676
3677 COPYINDEX_C2F(clo,_ga_clo, cndim);
3678 COPYINDEX_C2F(chi,_ga_chi, cndim);
3679
3680 wnga_matmul_patch(&transb, &transa, alpha, beta,
3681 b, _ga_blo, _ga_bhi,
3682 a, _ga_alo, _ga_ahi,
3683 c, _ga_clo, _ga_chi);
3684 }
3685
NGA_Matmul_patch64(char transa,char transb,void * alpha,void * beta,int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])3686 void NGA_Matmul_patch64(char transa, char transb, void* alpha, void *beta,
3687 int g_a, int64_t alo[], int64_t ahi[],
3688 int g_b, int64_t blo[], int64_t bhi[],
3689 int g_c, int64_t clo[], int64_t chi[])
3690
3691 {
3692 Integer a=(Integer)g_a;
3693 Integer andim = wnga_ndim(a);
3694
3695 Integer b=(Integer)g_b;
3696 Integer bndim = wnga_ndim(b);
3697
3698 Integer c=(Integer)g_c;
3699 Integer cndim = wnga_ndim(c);
3700
3701 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3702 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3703 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
3704 COPYINDEX_C2F(alo,_ga_alo, andim);
3705 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3706
3707 COPYINDEX_C2F(blo,_ga_blo, bndim);
3708 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3709
3710 COPYINDEX_C2F(clo,_ga_clo, cndim);
3711 COPYINDEX_C2F(chi,_ga_chi, cndim);
3712
3713 wnga_matmul_patch(&transb, &transa, alpha, beta,
3714 b, _ga_blo, _ga_bhi,
3715 a, _ga_alo, _ga_ahi,
3716 c, _ga_clo, _ga_chi);
3717 }
3718
NGA_Matmul_patch_alt(char transa,char transb,void * alpha,void * beta,int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])3719 void NGA_Matmul_patch_alt(char transa, char transb, void* alpha, void *beta,
3720 int g_a, int alo[], int ahi[],
3721 int g_b, int blo[], int bhi[],
3722 int g_c, int clo[], int chi[])
3723
3724 {
3725 Integer a=(Integer)g_a;
3726 Integer andim = wnga_ndim(a);
3727
3728 Integer b=(Integer)g_b;
3729 Integer bndim = wnga_ndim(b);
3730
3731 Integer c=(Integer)g_c;
3732 Integer cndim = wnga_ndim(c);
3733
3734 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3735 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3736 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
3737 COPYINDEX_C2F(alo,_ga_alo, andim);
3738 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3739
3740 COPYINDEX_C2F(blo,_ga_blo, bndim);
3741 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3742
3743 COPYINDEX_C2F(clo,_ga_clo, cndim);
3744 COPYINDEX_C2F(chi,_ga_chi, cndim);
3745
3746 wnga_matmul_patch_alt(&transb, &transa, alpha, beta,
3747 b, _ga_blo, _ga_bhi,
3748 a, _ga_alo, _ga_ahi,
3749 c, _ga_clo, _ga_chi);
3750 }
3751
NGA_Matmul_patch_alt64(char transa,char transb,void * alpha,void * beta,int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])3752 void NGA_Matmul_patch_alt64(char transa, char transb, void* alpha, void *beta,
3753 int g_a, int64_t alo[], int64_t ahi[],
3754 int g_b, int64_t blo[], int64_t bhi[],
3755 int g_c, int64_t clo[], int64_t chi[])
3756
3757 {
3758 Integer a=(Integer)g_a;
3759 Integer andim = wnga_ndim(a);
3760
3761 Integer b=(Integer)g_b;
3762 Integer bndim = wnga_ndim(b);
3763
3764 Integer c=(Integer)g_c;
3765 Integer cndim = wnga_ndim(c);
3766
3767 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3768 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3769 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
3770 COPYINDEX_C2F(alo,_ga_alo, andim);
3771 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3772
3773 COPYINDEX_C2F(blo,_ga_blo, bndim);
3774 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3775
3776 COPYINDEX_C2F(clo,_ga_clo, cndim);
3777 COPYINDEX_C2F(chi,_ga_chi, cndim);
3778
3779 wnga_matmul_patch_alt(&transb, &transa, alpha, beta,
3780 b, _ga_blo, _ga_bhi,
3781 a, _ga_alo, _ga_ahi,
3782 c, _ga_clo, _ga_chi);
3783 }
3784
NGA_Idot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3785 int NGA_Idot_patch(int g_a, char t_a, int alo[], int ahi[],
3786 int g_b, char t_b, int blo[], int bhi[])
3787 {
3788 int res;
3789 Integer a=(Integer)g_a;
3790 Integer andim = wnga_ndim(a);
3791
3792 Integer b=(Integer)g_b;
3793 Integer bndim = wnga_ndim(b);
3794
3795 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3796 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3797 COPYINDEX_C2F(alo,_ga_alo, andim);
3798 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3799
3800 COPYINDEX_C2F(blo,_ga_blo, bndim);
3801 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3802
3803 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3804 b, &t_b, _ga_blo, _ga_bhi, &res);
3805
3806 return res;
3807 }
3808
NGA_Ldot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3809 long NGA_Ldot_patch(int g_a, char t_a, int alo[], int ahi[],
3810 int g_b, char t_b, int blo[], int bhi[])
3811 {
3812 long res;
3813 Integer a=(Integer)g_a;
3814 Integer andim = wnga_ndim(a);
3815
3816 Integer b=(Integer)g_b;
3817 Integer bndim = wnga_ndim(b);
3818
3819 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3820 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3821 COPYINDEX_C2F(alo,_ga_alo, andim);
3822 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3823
3824 COPYINDEX_C2F(blo,_ga_blo, bndim);
3825 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3826
3827 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3828 b, &t_b, _ga_blo, _ga_bhi, &res);
3829
3830 return res;
3831 }
3832
NGA_Lldot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3833 long long NGA_Lldot_patch(int g_a, char t_a, int alo[], int ahi[],
3834 int g_b, char t_b, int blo[], int bhi[])
3835 {
3836 long res;
3837 Integer a=(Integer)g_a;
3838 Integer andim = wnga_ndim(a);
3839
3840 Integer b=(Integer)g_b;
3841 Integer bndim = wnga_ndim(b);
3842
3843 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3844 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3845 COPYINDEX_C2F(alo,_ga_alo, andim);
3846 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3847
3848 COPYINDEX_C2F(blo,_ga_blo, bndim);
3849 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3850
3851 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3852 b, &t_b, _ga_blo, _ga_bhi, &res);
3853
3854 return res;
3855 }
3856
NGA_Ddot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3857 double NGA_Ddot_patch(int g_a, char t_a, int alo[], int ahi[],
3858 int g_b, char t_b, int blo[], int bhi[])
3859 {
3860 double res;
3861 Integer a=(Integer)g_a;
3862 Integer andim = wnga_ndim(a);
3863
3864 Integer b=(Integer)g_b;
3865 Integer bndim = wnga_ndim(b);
3866
3867 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3868 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3869 COPYINDEX_C2F(alo,_ga_alo, andim);
3870 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3871
3872 COPYINDEX_C2F(blo,_ga_blo, bndim);
3873 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3874
3875 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3876 b, &t_b, _ga_blo, _ga_bhi, &res);
3877
3878 return res;
3879 }
3880
NGA_Zdot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3881 DoubleComplex NGA_Zdot_patch(int g_a, char t_a, int alo[], int ahi[],
3882 int g_b, char t_b, int blo[], int bhi[])
3883 {
3884 DoubleComplex res;
3885
3886 Integer a=(Integer)g_a;
3887 Integer andim = wnga_ndim(a);
3888
3889 Integer b=(Integer)g_b;
3890 Integer bndim = wnga_ndim(b);
3891
3892 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3893 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3894 COPYINDEX_C2F(alo,_ga_alo, andim);
3895 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3896
3897 COPYINDEX_C2F(blo,_ga_blo, bndim);
3898 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3899
3900 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3901 b, &t_b, _ga_blo, _ga_bhi, &res);
3902
3903 return res;
3904 }
3905
NGA_Cdot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3906 SingleComplex NGA_Cdot_patch(int g_a, char t_a, int alo[], int ahi[],
3907 int g_b, char t_b, int blo[], int bhi[])
3908 {
3909 SingleComplex res;
3910
3911 Integer a=(Integer)g_a;
3912 Integer andim = wnga_ndim(a);
3913
3914 Integer b=(Integer)g_b;
3915 Integer bndim = wnga_ndim(b);
3916
3917 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3918 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3919 COPYINDEX_C2F(alo,_ga_alo, andim);
3920 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3921
3922 COPYINDEX_C2F(blo,_ga_blo, bndim);
3923 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3924
3925 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3926 b, &t_b, _ga_blo, _ga_bhi, &res);
3927
3928 return res;
3929 }
3930
NGA_Fdot_patch(int g_a,char t_a,int alo[],int ahi[],int g_b,char t_b,int blo[],int bhi[])3931 float NGA_Fdot_patch(int g_a, char t_a, int alo[], int ahi[],
3932 int g_b, char t_b, int blo[], int bhi[])
3933 {
3934 float res;
3935 Integer a=(Integer)g_a;
3936 Integer andim = wnga_ndim(a);
3937
3938 Integer b=(Integer)g_b;
3939 Integer bndim = wnga_ndim(b);
3940
3941 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3942 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3943 COPYINDEX_C2F(alo,_ga_alo, andim);
3944 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3945
3946 COPYINDEX_C2F(blo,_ga_blo, bndim);
3947 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3948
3949 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3950 b, &t_b, _ga_blo, _ga_bhi, &res);
3951
3952 return res;
3953 }
3954
NGA_Idot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])3955 int NGA_Idot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
3956 int g_b, char t_b, int64_t blo[], int64_t bhi[])
3957 {
3958 int res;
3959 Integer a=(Integer)g_a;
3960 Integer andim = wnga_ndim(a);
3961
3962 Integer b=(Integer)g_b;
3963 Integer bndim = wnga_ndim(b);
3964
3965 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3966 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3967 COPYINDEX_C2F(alo,_ga_alo, andim);
3968 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3969
3970 COPYINDEX_C2F(blo,_ga_blo, bndim);
3971 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3972
3973 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3974 b, &t_b, _ga_blo, _ga_bhi, &res);
3975
3976 return res;
3977 }
3978
NGA_Ldot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])3979 long NGA_Ldot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
3980 int g_b, char t_b, int64_t blo[], int64_t bhi[])
3981 {
3982 long res;
3983 Integer a=(Integer)g_a;
3984 Integer andim = wnga_ndim(a);
3985
3986 Integer b=(Integer)g_b;
3987 Integer bndim = wnga_ndim(b);
3988
3989 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
3990 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
3991 COPYINDEX_C2F(alo,_ga_alo, andim);
3992 COPYINDEX_C2F(ahi,_ga_ahi, andim);
3993
3994 COPYINDEX_C2F(blo,_ga_blo, bndim);
3995 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
3996
3997 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
3998 b, &t_b, _ga_blo, _ga_bhi, &res);
3999
4000 return res;
4001 }
4002
NGA_Lldot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])4003 long long NGA_Lldot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
4004 int g_b, char t_b, int64_t blo[], int64_t bhi[])
4005 {
4006 long long res;
4007 Integer a=(Integer)g_a;
4008 Integer andim = wnga_ndim(a);
4009
4010 Integer b=(Integer)g_b;
4011 Integer bndim = wnga_ndim(b);
4012
4013 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4014 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4015 COPYINDEX_C2F(alo,_ga_alo, andim);
4016 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4017
4018 COPYINDEX_C2F(blo,_ga_blo, bndim);
4019 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4020
4021 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
4022 b, &t_b, _ga_blo, _ga_bhi, &res);
4023
4024 return res;
4025 }
4026
NGA_Ddot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])4027 double NGA_Ddot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
4028 int g_b, char t_b, int64_t blo[], int64_t bhi[])
4029 {
4030 double res;
4031 Integer a=(Integer)g_a;
4032 Integer andim = wnga_ndim(a);
4033
4034 Integer b=(Integer)g_b;
4035 Integer bndim = wnga_ndim(b);
4036
4037 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4038 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4039 COPYINDEX_C2F(alo,_ga_alo, andim);
4040 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4041
4042 COPYINDEX_C2F(blo,_ga_blo, bndim);
4043 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4044
4045 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
4046 b, &t_b, _ga_blo, _ga_bhi, &res);
4047
4048 return res;
4049 }
4050
NGA_Zdot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])4051 DoubleComplex NGA_Zdot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
4052 int g_b, char t_b, int64_t blo[], int64_t bhi[])
4053 {
4054 DoubleComplex res;
4055
4056 Integer a=(Integer)g_a;
4057 Integer andim = wnga_ndim(a);
4058
4059 Integer b=(Integer)g_b;
4060 Integer bndim = wnga_ndim(b);
4061
4062 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4063 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4064 COPYINDEX_C2F(alo,_ga_alo, andim);
4065 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4066
4067 COPYINDEX_C2F(blo,_ga_blo, bndim);
4068 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4069
4070 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
4071 b, &t_b, _ga_blo, _ga_bhi, &res);
4072
4073 return res;
4074 }
4075
NGA_Cdot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])4076 SingleComplex NGA_Cdot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
4077 int g_b, char t_b, int64_t blo[], int64_t bhi[])
4078 {
4079 SingleComplex res;
4080
4081 Integer a=(Integer)g_a;
4082 Integer andim = wnga_ndim(a);
4083
4084 Integer b=(Integer)g_b;
4085 Integer bndim = wnga_ndim(b);
4086
4087 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4088 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4089 COPYINDEX_C2F(alo,_ga_alo, andim);
4090 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4091
4092 COPYINDEX_C2F(blo,_ga_blo, bndim);
4093 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4094
4095 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
4096 b, &t_b, _ga_blo, _ga_bhi, &res);
4097
4098 return res;
4099 }
4100
NGA_Fdot_patch64(int g_a,char t_a,int64_t alo[],int64_t ahi[],int g_b,char t_b,int64_t blo[],int64_t bhi[])4101 float NGA_Fdot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[],
4102 int g_b, char t_b, int64_t blo[], int64_t bhi[])
4103 {
4104 float res;
4105 Integer a=(Integer)g_a;
4106 Integer andim = wnga_ndim(a);
4107
4108 Integer b=(Integer)g_b;
4109 Integer bndim = wnga_ndim(b);
4110
4111 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4112 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4113 COPYINDEX_C2F(alo,_ga_alo, andim);
4114 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4115
4116 COPYINDEX_C2F(blo,_ga_blo, bndim);
4117 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4118
4119 wnga_dot_patch(a, &t_a, _ga_alo, _ga_ahi,
4120 b, &t_b, _ga_blo, _ga_bhi, &res);
4121
4122 return res;
4123 }
4124
4125
NGA_Fill_patch(int g_a,int lo[],int hi[],void * val)4126 void NGA_Fill_patch(int g_a, int lo[], int hi[], void *val)
4127 {
4128 Integer a=(Integer)g_a;
4129 Integer ndim = wnga_ndim(a);
4130 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4131 COPYINDEX_C2F(lo,_ga_lo, ndim);
4132 COPYINDEX_C2F(hi,_ga_hi, ndim);
4133
4134 wnga_fill_patch(a, _ga_lo, _ga_hi, val);
4135 }
4136
NGA_Fill_patch64(int g_a,int64_t lo[],int64_t hi[],void * val)4137 void NGA_Fill_patch64(int g_a, int64_t lo[], int64_t hi[], void *val)
4138 {
4139 Integer a=(Integer)g_a;
4140 Integer ndim = wnga_ndim(a);
4141 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4142 COPYINDEX_C2F(lo,_ga_lo, ndim);
4143 COPYINDEX_C2F(hi,_ga_hi, ndim);
4144
4145 wnga_fill_patch(a, _ga_lo, _ga_hi, val);
4146 }
4147
NGA_Zero_patch(int g_a,int lo[],int hi[])4148 void NGA_Zero_patch(int g_a, int lo[], int hi[])
4149 {
4150 Integer a=(Integer)g_a;
4151 Integer ndim = wnga_ndim(a);
4152 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4153 COPYINDEX_C2F(lo,_ga_lo, ndim);
4154 COPYINDEX_C2F(hi,_ga_hi, ndim);
4155
4156 wnga_zero_patch(a, _ga_lo, _ga_hi);
4157 }
4158
NGA_Zero_patch64(int g_a,int64_t lo[],int64_t hi[])4159 void NGA_Zero_patch64(int g_a, int64_t lo[], int64_t hi[])
4160 {
4161 Integer a=(Integer)g_a;
4162 Integer ndim = wnga_ndim(a);
4163 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4164 COPYINDEX_C2F(lo,_ga_lo, ndim);
4165 COPYINDEX_C2F(hi,_ga_hi, ndim);
4166
4167 wnga_zero_patch(a, _ga_lo, _ga_hi);
4168 }
4169
NGA_Scale_patch(int g_a,int lo[],int hi[],void * alpha)4170 void NGA_Scale_patch(int g_a, int lo[], int hi[], void *alpha)
4171 {
4172 Integer a=(Integer)g_a;
4173 Integer ndim = wnga_ndim(a);
4174 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4175 COPYINDEX_C2F(lo,_ga_lo, ndim);
4176 COPYINDEX_C2F(hi,_ga_hi, ndim);
4177
4178 wnga_scale_patch(a, _ga_lo, _ga_hi, alpha);
4179 }
4180
NGA_Scale_patch64(int g_a,int64_t lo[],int64_t hi[],void * alpha)4181 void NGA_Scale_patch64(int g_a, int64_t lo[], int64_t hi[], void *alpha)
4182 {
4183 Integer a=(Integer)g_a;
4184 Integer ndim = wnga_ndim(a);
4185 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4186 COPYINDEX_C2F(lo,_ga_lo, ndim);
4187 COPYINDEX_C2F(hi,_ga_hi, ndim);
4188
4189 wnga_scale_patch(a, _ga_lo, _ga_hi, alpha);
4190 }
4191
NGA_Add_patch(void * alpha,int g_a,int alo[],int ahi[],void * beta,int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])4192 void NGA_Add_patch(void * alpha, int g_a, int alo[], int ahi[],
4193 void * beta, int g_b, int blo[], int bhi[],
4194 int g_c, int clo[], int chi[])
4195 {
4196 Integer a=(Integer)g_a;
4197 Integer andim = wnga_ndim(a);
4198
4199 Integer b=(Integer)g_b;
4200 Integer bndim = wnga_ndim(b);
4201
4202 Integer c=(Integer)g_c;
4203 Integer cndim = wnga_ndim(c);
4204 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4205 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4206 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4207
4208 COPYINDEX_C2F(alo,_ga_alo, andim);
4209 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4210
4211 COPYINDEX_C2F(blo,_ga_blo, bndim);
4212 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4213
4214 COPYINDEX_C2F(clo,_ga_clo, cndim);
4215 COPYINDEX_C2F(chi,_ga_chi, cndim);
4216
4217 wnga_add_patch(alpha, a, _ga_alo, _ga_ahi, beta, b, _ga_blo, _ga_bhi,
4218 c, _ga_clo, _ga_chi);
4219 }
4220
NGA_Add_patch64(void * alpha,int g_a,int64_t alo[],int64_t ahi[],void * beta,int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])4221 void NGA_Add_patch64(void * alpha, int g_a, int64_t alo[], int64_t ahi[],
4222 void * beta, int g_b, int64_t blo[], int64_t bhi[],
4223 int g_c, int64_t clo[], int64_t chi[])
4224 {
4225 Integer a=(Integer)g_a;
4226 Integer andim = wnga_ndim(a);
4227
4228 Integer b=(Integer)g_b;
4229 Integer bndim = wnga_ndim(b);
4230
4231 Integer c=(Integer)g_c;
4232 Integer cndim = wnga_ndim(c);
4233
4234 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4235 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4236 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4237 COPYINDEX_C2F(alo,_ga_alo, andim);
4238 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4239
4240 COPYINDEX_C2F(blo,_ga_blo, bndim);
4241 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4242
4243 COPYINDEX_C2F(clo,_ga_clo, cndim);
4244 COPYINDEX_C2F(chi,_ga_chi, cndim);
4245
4246 wnga_add_patch(alpha, a, _ga_alo, _ga_ahi, beta, b, _ga_blo, _ga_bhi,
4247 c, _ga_clo, _ga_chi);
4248 }
4249
4250
GA_Print_patch(int g_a,int ilo,int ihi,int jlo,int jhi,int pretty)4251 void GA_Print_patch(int g_a,int ilo,int ihi,int jlo,int jhi,int pretty)
4252 {
4253 Integer a = (Integer)g_a;
4254 Integer lo[2];
4255 Integer hi[2];
4256 Integer p = (Integer) pretty;
4257 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4258
4259 lo[0] = ilo; lo[1] = jlo;
4260 hi[0] = ihi; lo[1] = jhi;
4261 COPYINDEX_C2F(lo,_ga_lo,2);
4262 COPYINDEX_C2F(hi,_ga_hi,2);
4263 wnga_print_patch(a, _ga_lo, _ga_hi, p);
4264 }
4265
4266
NGA_Print_patch(int g_a,int lo[],int hi[],int pretty)4267 void NGA_Print_patch(int g_a, int lo[], int hi[], int pretty)
4268 {
4269 Integer a=(Integer)g_a;
4270 Integer ndim = wnga_ndim(a);
4271 Integer p = (Integer)pretty;
4272 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4273
4274 COPYINDEX_C2F(lo,_ga_lo, ndim);
4275 COPYINDEX_C2F(hi,_ga_hi, ndim);
4276 wnga_print_patch(a, _ga_lo, _ga_hi, p);
4277 }
4278
NGA_Print_patch64(int g_a,int64_t lo[],int64_t hi[],int pretty)4279 void NGA_Print_patch64(int g_a, int64_t lo[], int64_t hi[], int pretty)
4280 {
4281 Integer a=(Integer)g_a;
4282 Integer ndim = wnga_ndim(a);
4283 Integer p = (Integer)pretty;
4284 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4285 COPYINDEX_C2F(lo,_ga_lo, ndim);
4286 COPYINDEX_C2F(hi,_ga_hi, ndim);
4287
4288 wnga_print_patch(a, _ga_lo, _ga_hi, p);
4289 }
4290
GA_Print(int g_a)4291 void GA_Print(int g_a)
4292 {
4293 Integer a=(Integer)g_a;
4294 wnga_print(a);
4295 }
4296
GA_Print_file(FILE * file,int g_a)4297 void GA_Print_file(FILE *file, int g_a)
4298 {
4299 Integer G_a = g_a;
4300 wnga_print_file(file, G_a);
4301 }
4302
GA_Diag_seq(int g_a,int g_s,int g_v,void * eval)4303 void GA_Diag_seq(int g_a, int g_s, int g_v, void *eval)
4304 {
4305 Integer a = (Integer)g_a;
4306 Integer s = (Integer)g_s;
4307 Integer v = (Integer)g_v;
4308
4309 wnga_diag_seq(a, s, v, eval);
4310 }
4311
GA_Diag_std_seq(int g_a,int g_v,void * eval)4312 void GA_Diag_std_seq(int g_a, int g_v, void *eval)
4313 {
4314 Integer a = (Integer)g_a;
4315 Integer v = (Integer)g_v;
4316
4317 wnga_diag_std_seq(a, v, eval);
4318 }
4319
GA_Diag(int g_a,int g_s,int g_v,void * eval)4320 void GA_Diag(int g_a, int g_s, int g_v, void *eval)
4321 {
4322 Integer a = (Integer)g_a;
4323 Integer s = (Integer)g_s;
4324 Integer v = (Integer)g_v;
4325
4326 wnga_diag(a, s, v, eval);
4327 }
4328
GA_Diag_std(int g_a,int g_v,void * eval)4329 void GA_Diag_std(int g_a, int g_v, void *eval)
4330 {
4331 Integer a = (Integer)g_a;
4332 Integer v = (Integer)g_v;
4333
4334 wnga_diag_std(a, v, eval);
4335 }
4336
GA_Diag_reuse(int reuse,int g_a,int g_s,int g_v,void * eval)4337 void GA_Diag_reuse(int reuse, int g_a, int g_s, int g_v, void *eval)
4338 {
4339 Integer r = (Integer)reuse;
4340 Integer a = (Integer)g_a;
4341 Integer s = (Integer)g_s;
4342 Integer v = (Integer)g_v;
4343
4344 wnga_diag_reuse(r, a, s, v, eval);
4345 }
4346
GA_Lu_solve(char tran,int g_a,int g_b)4347 void GA_Lu_solve(char tran, int g_a, int g_b)
4348 {
4349 Integer a = (Integer)g_a;
4350 Integer b = (Integer)g_b;
4351
4352 Integer t;
4353
4354 if(tran == 't' || tran == 'T') t = 1;
4355 else t = 0;
4356
4357 wnga_lu_solve_alt(t, a, b);
4358 }
4359
GA_Llt_solve(int g_a,int g_b)4360 int GA_Llt_solve(int g_a, int g_b)
4361 {
4362 Integer res;
4363 Integer a = (Integer)g_a;
4364 Integer b = (Integer)g_b;
4365
4366 res = wnga_llt_solve(a, b);
4367
4368 return((int)res);
4369 }
4370
GA_Solve(int g_a,int g_b)4371 int GA_Solve(int g_a, int g_b)
4372 {
4373 Integer res;
4374 Integer a = (Integer)g_a;
4375 Integer b = (Integer)g_b;
4376
4377 res = wnga_solve(a, b);
4378
4379 return((int)res);
4380 }
4381
GA_Spd_invert(int g_a)4382 int GA_Spd_invert(int g_a)
4383 {
4384 Integer res;
4385 Integer a = (Integer)g_a;
4386
4387 res = wnga_spd_invert(a);
4388
4389 return((int)res);
4390 }
4391
GA_Summarize(int verbose)4392 void GA_Summarize(int verbose)
4393 {
4394 Integer v = (Integer)verbose;
4395
4396 wnga_summarize(v);
4397 }
4398
GA_Symmetrize(int g_a)4399 void GA_Symmetrize(int g_a)
4400 {
4401 Integer a = (Integer)g_a;
4402
4403 wnga_symmetrize(a);
4404 }
4405
NGA_Symmetrize(int g_a)4406 void NGA_Symmetrize(int g_a)
4407 {
4408 Integer a = (Integer)g_a;
4409
4410 wnga_symmetrize(a);
4411 }
4412
GA_Transpose(int g_a,int g_b)4413 void GA_Transpose(int g_a, int g_b)
4414 {
4415 Integer a = (Integer)g_a;
4416 Integer b = (Integer)g_b;
4417
4418 wnga_transpose(a, b);
4419 }
4420
4421
GA_Print_distribution(int g_a)4422 void GA_Print_distribution(int g_a)
4423 {
4424 #ifdef USE_FAPI
4425 wnga_print_distribution(1,(Integer)g_a);
4426 #else
4427 wnga_print_distribution(0,(Integer)g_a);
4428 #endif
4429 }
4430
4431
NGA_Release_update(int g_a,int lo[],int hi[])4432 void NGA_Release_update(int g_a, int lo[], int hi[])
4433 {
4434 Integer a = (Integer)g_a;
4435 Integer ndim = wnga_ndim(a);
4436 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4437 COPYINDEX_C2F(lo,_ga_lo,ndim);
4438 COPYINDEX_C2F(hi,_ga_hi,ndim);
4439
4440 wnga_release_update(a,_ga_lo, _ga_hi);
4441 }
4442
NGA_Release_update64(int g_a,int64_t lo[],int64_t hi[])4443 void NGA_Release_update64(int g_a, int64_t lo[], int64_t hi[])
4444 {
4445 Integer a = (Integer)g_a;
4446 Integer ndim = wnga_ndim(a);
4447 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4448 COPYINDEX_C2F(lo,_ga_lo,ndim);
4449 COPYINDEX_C2F(hi,_ga_hi,ndim);
4450
4451 wnga_release_update(a,_ga_lo, _ga_hi);
4452 }
4453
NGA_Release_update_block(int g_a,int idx)4454 void NGA_Release_update_block(int g_a, int idx)
4455 {
4456 Integer a=(Integer)g_a;
4457 Integer iblock = (Integer)idx;
4458
4459 wnga_release_update_block(a, iblock);
4460 }
4461
NGA_Release_update_block_grid(int g_a,int index[])4462 void NGA_Release_update_block_grid(int g_a, int index[])
4463 {
4464 Integer a=(Integer)g_a;
4465 Integer ndim = wnga_ndim(a);
4466 Integer _ga_lo[MAXDIM];
4467 COPYINDEX_C2F(index,_ga_lo,ndim);
4468 wnga_release_update_block_grid(a, _ga_lo);
4469 }
4470
NGA_Release_update_block_segment(int g_a,int idx)4471 void NGA_Release_update_block_segment(int g_a, int idx)
4472 {
4473 Integer a=(Integer)g_a;
4474 Integer iproc = (Integer)idx;
4475
4476 wnga_release_update_block_segment(a, iproc);
4477 }
4478
NGA_Release_update_ghost_element(int g_a,int index[])4479 void NGA_Release_update_ghost_element(int g_a, int index[])
4480 {
4481 Integer a=(Integer)g_a;
4482 Integer ndim = wnga_ndim(a);
4483 Integer _ga_lo[MAXDIM];
4484 COPYINDEX_C2F(index,_ga_lo,ndim);
4485 wnga_release_update_ghost_element(a, _ga_lo);
4486 }
4487
NGA_Release_update_ghost_element64(int g_a,int64_t index[])4488 void NGA_Release_update_ghost_element64(int g_a, int64_t index[])
4489 {
4490 Integer a=(Integer)g_a;
4491 Integer ndim = wnga_ndim(a);
4492 Integer _ga_lo[MAXDIM];
4493 COPYINDEX_C2F(index,_ga_lo,ndim);
4494 wnga_release_update_ghost_element(a, _ga_lo);
4495 }
4496
NGA_Release_update_ghosts(int g_a)4497 void NGA_Release_update_ghosts(int g_a)
4498 {
4499 Integer a=(Integer)g_a;
4500 wnga_release_update_ghosts(a);
4501 }
4502
GA_Ndim(int g_a)4503 int GA_Ndim(int g_a)
4504 {
4505 Integer a = (Integer)g_a;
4506 return (int)wnga_ndim(a);
4507 }
4508
NGA_Ndim(int g_a)4509 int NGA_Ndim(int g_a)
4510 {
4511 Integer a = (Integer)g_a;
4512 return (int)wnga_ndim(a);
4513 }
4514
4515 /*Limin's functions */
4516
4517
GA_Step_bound_info(int g_xx,int g_vv,int g_xxll,int g_xxuu,void * boundmin,void * wolfemin,void * boundmax)4518 void GA_Step_bound_info(int g_xx, int g_vv, int g_xxll, int g_xxuu, void *boundmin, void *wolfemin, void *boundmax)
4519 {
4520 Integer xx = (Integer)g_xx;
4521 Integer vv = (Integer)g_vv;
4522 Integer xxll = (Integer)g_xxll;
4523 Integer xxuu = (Integer)g_xxuu;
4524 wnga_step_bound_info(xx, vv, xxll, xxuu, boundmin, wolfemin, boundmax);
4525 }
4526
GA_Step_bound_info_patch(int g_xx,int xxlo[],int xxhi[],int g_vv,int vvlo[],int vvhi[],int g_xxll,int xxlllo[],int xxllhi[],int g_xxuu,int xxuulo[],int xxuuhi[],void * boundmin,void * wolfemin,void * boundmax)4527 void GA_Step_bound_info_patch(int g_xx, int xxlo[], int xxhi[], int g_vv, int vvlo[], int vvhi[], int g_xxll, int xxlllo[], int xxllhi[], int g_xxuu, int xxuulo[], int xxuuhi[], void *boundmin, void *wolfemin, void *boundmax)
4528 {
4529 Integer xx = (Integer)g_xx;
4530 Integer vv = (Integer)g_vv;
4531 Integer xxll = (Integer)g_xxll;
4532 Integer xxuu = (Integer)g_xxuu;
4533 Integer ndim = wnga_ndim(xx);
4534 Integer _ga_xxlo[MAXDIM], _ga_xxhi[MAXDIM];
4535 Integer _ga_vvlo[MAXDIM], _ga_vvhi[MAXDIM];
4536 Integer _ga_xxlllo[MAXDIM], _ga_xxllhi[MAXDIM];
4537 Integer _ga_xxuulo[MAXDIM], _ga_xxuuhi[MAXDIM];
4538 COPYINDEX_C2F(xxlo,_ga_xxlo, ndim);
4539 COPYINDEX_C2F(xxhi,_ga_xxhi, ndim);
4540 COPYINDEX_C2F(vvlo,_ga_vvlo, ndim);
4541 COPYINDEX_C2F(vvhi,_ga_vvhi, ndim);
4542 COPYINDEX_C2F(xxlllo,_ga_xxlllo, ndim);
4543 COPYINDEX_C2F(xxllhi,_ga_xxllhi, ndim);
4544 COPYINDEX_C2F(xxuulo,_ga_xxuulo, ndim);
4545 COPYINDEX_C2F(xxuuhi,_ga_xxuuhi, ndim);
4546 wnga_step_bound_info_patch(xx, _ga_xxlo, _ga_xxhi, vv, _ga_vvlo, _ga_vvhi, xxll, _ga_xxlllo, _ga_xxllhi, xxuu, _ga_xxuulo, _ga_xxuuhi ,
4547 boundmin,wolfemin,boundmax);
4548 }
4549
GA_Step_bound_info_patch64(int g_xx,int64_t xxlo[],int64_t xxhi[],int g_vv,int64_t vvlo[],int64_t vvhi[],int g_xxll,int64_t xxlllo[],int64_t xxllhi[],int64_t g_xxuu,int64_t xxuulo[],int64_t xxuuhi[],void * boundmin,void * wolfemin,void * boundmax)4550 void GA_Step_bound_info_patch64(int g_xx, int64_t xxlo[], int64_t xxhi[],
4551 int g_vv, int64_t vvlo[], int64_t vvhi[],
4552 int g_xxll, int64_t xxlllo[], int64_t xxllhi[],
4553 int64_t g_xxuu, int64_t xxuulo[], int64_t xxuuhi[],
4554 void *boundmin, void *wolfemin, void *boundmax)
4555 {
4556 Integer xx = (Integer)g_xx;
4557 Integer vv = (Integer)g_vv;
4558 Integer xxll = (Integer)g_xxll;
4559 Integer xxuu = (Integer)g_xxuu;
4560 Integer ndim = wnga_ndim(xx);
4561 Integer _ga_xxlo[MAXDIM], _ga_xxhi[MAXDIM];
4562 Integer _ga_vvlo[MAXDIM], _ga_vvhi[MAXDIM];
4563 Integer _ga_xxlllo[MAXDIM], _ga_xxllhi[MAXDIM];
4564 Integer _ga_xxuulo[MAXDIM], _ga_xxuuhi[MAXDIM];
4565 COPYINDEX_C2F(xxlo,_ga_xxlo, ndim);
4566 COPYINDEX_C2F(xxhi,_ga_xxhi, ndim);
4567 COPYINDEX_C2F(vvlo,_ga_vvlo, ndim);
4568 COPYINDEX_C2F(vvhi,_ga_vvhi, ndim);
4569 COPYINDEX_C2F(xxlllo,_ga_xxlllo, ndim);
4570 COPYINDEX_C2F(xxllhi,_ga_xxllhi, ndim);
4571 COPYINDEX_C2F(xxuulo,_ga_xxuulo, ndim);
4572 COPYINDEX_C2F(xxuuhi,_ga_xxuuhi, ndim);
4573 wnga_step_bound_info_patch(xx, _ga_xxlo, _ga_xxhi, vv, _ga_vvlo, _ga_vvhi, xxll, _ga_xxlllo, _ga_xxllhi, xxuu, _ga_xxuulo, _ga_xxuuhi ,
4574 boundmin,wolfemin,boundmax);
4575 }
4576
GA_Step_max(int g_a,int g_b,void * step)4577 void GA_Step_max(int g_a, int g_b, void *step)
4578 {
4579 Integer a = (Integer)g_a;
4580 Integer b = (Integer)g_b;
4581 wnga_step_max(a, b, step);
4582 }
4583
GA_Step_max_patch(int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],void * step)4584 void GA_Step_max_patch(int g_a, int alo[], int ahi[], int g_b, int blo[], int bhi[], void *step)
4585 {
4586 Integer a = (Integer)g_a;
4587 Integer b = (Integer)g_b;
4588 Integer ndim = wnga_ndim(a);
4589 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4590 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4591 COPYINDEX_C2F(alo,_ga_alo, ndim);
4592 COPYINDEX_C2F(ahi,_ga_ahi, ndim);
4593 COPYINDEX_C2F(blo,_ga_blo, ndim);
4594 COPYINDEX_C2F(bhi,_ga_bhi, ndim);
4595 wnga_step_max_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, step);
4596 }
4597
GA_Step_max_patch64(int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],void * step)4598 void GA_Step_max_patch64(int g_a, int64_t alo[], int64_t ahi[],
4599 int g_b, int64_t blo[], int64_t bhi[], void *step)
4600 {
4601 Integer a = (Integer)g_a;
4602 Integer b = (Integer)g_b;
4603 Integer ndim = wnga_ndim(a);
4604 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4605 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4606 COPYINDEX_C2F(alo,_ga_alo, ndim);
4607 COPYINDEX_C2F(ahi,_ga_ahi, ndim);
4608 COPYINDEX_C2F(blo,_ga_blo, ndim);
4609 COPYINDEX_C2F(bhi,_ga_bhi, ndim);
4610 wnga_step_max_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, step);
4611 }
4612
GA_Abs_value(int g_a)4613 void GA_Abs_value(int g_a)
4614 {
4615 Integer a = (Integer)g_a;
4616 wnga_abs_value(a);
4617 }
4618
GA_Add_constant(int g_a,void * alpha)4619 void GA_Add_constant(int g_a, void *alpha)
4620 {
4621 Integer a = (Integer)g_a;
4622 wnga_add_constant(a, alpha);
4623 }
4624
4625
GA_Recip(int g_a)4626 void GA_Recip(int g_a)
4627 {
4628 Integer a = (Integer)g_a;
4629 wnga_recip(a);
4630 }
4631
GA_Elem_multiply(int g_a,int g_b,int g_c)4632 void GA_Elem_multiply(int g_a, int g_b, int g_c)
4633 {
4634 Integer a = (Integer)g_a;
4635 Integer b = (Integer)g_b;
4636 Integer c = (Integer)g_c;
4637 wnga_elem_multiply(a, b, c);
4638 }
4639
GA_Elem_divide(int g_a,int g_b,int g_c)4640 void GA_Elem_divide(int g_a, int g_b, int g_c)
4641 {
4642 Integer a = (Integer)g_a;
4643 Integer b = (Integer)g_b;
4644 Integer c = (Integer)g_c;
4645 wnga_elem_divide(a, b, c);
4646 }
4647
GA_Elem_maximum(int g_a,int g_b,int g_c)4648 void GA_Elem_maximum(int g_a, int g_b, int g_c)
4649 {
4650 Integer a = (Integer)g_a;
4651 Integer b = (Integer)g_b;
4652 Integer c = (Integer)g_c;
4653 wnga_elem_maximum(a, b, c);
4654 }
4655
4656
GA_Elem_minimum(int g_a,int g_b,int g_c)4657 void GA_Elem_minimum(int g_a, int g_b, int g_c)
4658 {
4659 Integer a = (Integer)g_a;
4660 Integer b = (Integer)g_b;
4661 Integer c = (Integer)g_c;
4662 wnga_elem_minimum(a, b, c);
4663 }
4664
4665
GA_Abs_value_patch(int g_a,int * lo,int * hi)4666 void GA_Abs_value_patch(int g_a, int *lo, int *hi)
4667 {
4668 Integer a = (Integer)g_a;
4669 Integer ndim = wnga_ndim(a);
4670 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4671 COPYINDEX_C2F(lo,_ga_lo, ndim);
4672 COPYINDEX_C2F(hi,_ga_hi, ndim);
4673 wnga_abs_value_patch(a,_ga_lo, _ga_hi);
4674 }
4675
GA_Abs_value_patch64(int g_a,int64_t * lo,int64_t * hi)4676 void GA_Abs_value_patch64(int g_a, int64_t *lo, int64_t *hi)
4677 {
4678 Integer a = (Integer)g_a;
4679 Integer ndim = wnga_ndim(a);
4680 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4681 COPYINDEX_C2F(lo,_ga_lo, ndim);
4682 COPYINDEX_C2F(hi,_ga_hi, ndim);
4683 wnga_abs_value_patch(a,_ga_lo, _ga_hi);
4684 }
4685
GA_Add_constant_patch(int g_a,int * lo,int * hi,void * alpha)4686 void GA_Add_constant_patch(int g_a, int *lo, int* hi, void *alpha)
4687 {
4688 Integer a = (Integer)g_a;
4689 Integer ndim = wnga_ndim(a);
4690 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4691 COPYINDEX_C2F(lo,_ga_lo, ndim);
4692 COPYINDEX_C2F(hi,_ga_hi, ndim);
4693 wnga_add_constant_patch(a, _ga_lo, _ga_hi, alpha);
4694 }
4695
GA_Add_constant_patch64(int g_a,int64_t * lo,int64_t * hi,void * alpha)4696 void GA_Add_constant_patch64(int g_a, int64_t *lo, int64_t *hi, void *alpha)
4697 {
4698 Integer a = (Integer)g_a;
4699 Integer ndim = wnga_ndim(a);
4700 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4701 COPYINDEX_C2F(lo,_ga_lo, ndim);
4702 COPYINDEX_C2F(hi,_ga_hi, ndim);
4703 wnga_add_constant_patch(a, _ga_lo, _ga_hi, alpha);
4704 }
4705
GA_Recip_patch(int g_a,int * lo,int * hi)4706 void GA_Recip_patch(int g_a, int *lo, int *hi)
4707 {
4708 Integer a = (Integer)g_a;
4709 Integer ndim = wnga_ndim(a);
4710 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4711 COPYINDEX_C2F(lo,_ga_lo, ndim);
4712 COPYINDEX_C2F(hi,_ga_hi, ndim);
4713 wnga_recip_patch(a,_ga_lo, _ga_hi);
4714 }
4715
GA_Recip_patch64(int g_a,int64_t * lo,int64_t * hi)4716 void GA_Recip_patch64(int g_a, int64_t *lo, int64_t *hi)
4717 {
4718 Integer a = (Integer)g_a;
4719 Integer ndim = wnga_ndim(a);
4720 Integer _ga_lo[MAXDIM], _ga_hi[MAXDIM];
4721 COPYINDEX_C2F(lo,_ga_lo, ndim);
4722 COPYINDEX_C2F(hi,_ga_hi, ndim);
4723 wnga_recip_patch(a,_ga_lo, _ga_hi);
4724 }
4725
GA_Elem_multiply_patch(int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])4726 void GA_Elem_multiply_patch(int g_a, int alo[], int ahi[],
4727 int g_b, int blo[], int bhi[],
4728 int g_c, int clo[], int chi[])
4729 {
4730 Integer a = (Integer)g_a;
4731 Integer b = (Integer)g_b;
4732 Integer c = (Integer)g_c;
4733 Integer andim = wnga_ndim(a);
4734 Integer bndim = wnga_ndim(b);
4735 Integer cndim = wnga_ndim(c);
4736 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4737 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4738 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4739 COPYINDEX_C2F(alo,_ga_alo, andim);
4740 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4741 COPYINDEX_C2F(blo,_ga_blo, bndim);
4742 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4743 COPYINDEX_C2F(clo,_ga_clo, cndim);
4744 COPYINDEX_C2F(chi,_ga_chi, cndim);
4745 wnga_elem_multiply_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4746 }
4747
GA_Elem_multiply_patch64(int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])4748 void GA_Elem_multiply_patch64(int g_a, int64_t alo[], int64_t ahi[],
4749 int g_b, int64_t blo[], int64_t bhi[],
4750 int g_c, int64_t clo[], int64_t chi[])
4751 {
4752 Integer a = (Integer)g_a;
4753 Integer b = (Integer)g_b;
4754 Integer c = (Integer)g_c;
4755 Integer andim = wnga_ndim(a);
4756 Integer bndim = wnga_ndim(b);
4757 Integer cndim = wnga_ndim(c);
4758 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4759 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4760 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4761 COPYINDEX_C2F(alo,_ga_alo, andim);
4762 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4763 COPYINDEX_C2F(blo,_ga_blo, bndim);
4764 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4765 COPYINDEX_C2F(clo,_ga_clo, cndim);
4766 COPYINDEX_C2F(chi,_ga_chi, cndim);
4767 wnga_elem_multiply_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4768 }
4769
GA_Elem_divide_patch(int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])4770 void GA_Elem_divide_patch(int g_a, int alo[], int ahi[],
4771 int g_b, int blo[], int bhi[],
4772 int g_c, int clo[], int chi[])
4773 {
4774 Integer a = (Integer)g_a;
4775 Integer b = (Integer)g_b;
4776 Integer c = (Integer)g_c;
4777 Integer andim = wnga_ndim(a);
4778 Integer bndim = wnga_ndim(b);
4779 Integer cndim = wnga_ndim(c);
4780 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4781 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4782 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4783 COPYINDEX_C2F(alo,_ga_alo, andim);
4784 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4785 COPYINDEX_C2F(blo,_ga_blo, bndim);
4786 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4787 COPYINDEX_C2F(clo,_ga_clo, cndim);
4788 COPYINDEX_C2F(chi,_ga_chi, cndim);
4789 wnga_elem_divide_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4790 }
4791
GA_Elem_divide_patch64(int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])4792 void GA_Elem_divide_patch64(int g_a, int64_t alo[], int64_t ahi[],
4793 int g_b, int64_t blo[], int64_t bhi[],
4794 int g_c, int64_t clo[], int64_t chi[])
4795 {
4796 Integer a = (Integer)g_a;
4797 Integer b = (Integer)g_b;
4798 Integer c = (Integer)g_c;
4799 Integer andim = wnga_ndim(a);
4800 Integer bndim = wnga_ndim(b);
4801 Integer cndim = wnga_ndim(c);
4802 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4803 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4804 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4805 COPYINDEX_C2F(alo,_ga_alo, andim);
4806 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4807 COPYINDEX_C2F(blo,_ga_blo, bndim);
4808 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4809 COPYINDEX_C2F(clo,_ga_clo, cndim);
4810 COPYINDEX_C2F(chi,_ga_chi, cndim);
4811 wnga_elem_divide_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4812 }
4813
4814
GA_Elem_maximum_patch(int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])4815 void GA_Elem_maximum_patch(int g_a, int alo[], int ahi[],
4816 int g_b, int blo[], int bhi[],
4817 int g_c, int clo[], int chi[])
4818 {
4819 Integer a = (Integer)g_a;
4820 Integer b = (Integer)g_b;
4821 Integer c = (Integer)g_c;
4822 Integer andim = wnga_ndim(a);
4823 Integer bndim = wnga_ndim(b);
4824 Integer cndim = wnga_ndim(c);
4825 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4826 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4827 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4828 COPYINDEX_C2F(alo,_ga_alo, andim);
4829 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4830 COPYINDEX_C2F(blo,_ga_blo, bndim);
4831 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4832 COPYINDEX_C2F(clo,_ga_clo, cndim);
4833 COPYINDEX_C2F(chi,_ga_chi, cndim);
4834 wnga_elem_maximum_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4835 }
4836
GA_Elem_maximum_patch64(int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])4837 void GA_Elem_maximum_patch64(int g_a, int64_t alo[], int64_t ahi[],
4838 int g_b, int64_t blo[], int64_t bhi[],
4839 int g_c, int64_t clo[], int64_t chi[])
4840 {
4841 Integer a = (Integer)g_a;
4842 Integer b = (Integer)g_b;
4843 Integer c = (Integer)g_c;
4844 Integer andim = wnga_ndim(a);
4845 Integer bndim = wnga_ndim(b);
4846 Integer cndim = wnga_ndim(c);
4847 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4848 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4849 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4850 COPYINDEX_C2F(alo,_ga_alo, andim);
4851 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4852 COPYINDEX_C2F(blo,_ga_blo, bndim);
4853 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4854 COPYINDEX_C2F(clo,_ga_clo, cndim);
4855 COPYINDEX_C2F(chi,_ga_chi, cndim);
4856 wnga_elem_maximum_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4857 }
4858
GA_Elem_minimum_patch(int g_a,int alo[],int ahi[],int g_b,int blo[],int bhi[],int g_c,int clo[],int chi[])4859 void GA_Elem_minimum_patch(int g_a, int alo[], int ahi[],
4860 int g_b, int blo[], int bhi[],
4861 int g_c, int clo[], int chi[])
4862 {
4863 Integer a = (Integer)g_a;
4864 Integer b = (Integer)g_b;
4865 Integer c = (Integer)g_c;
4866 Integer andim = wnga_ndim(a);
4867 Integer bndim = wnga_ndim(b);
4868 Integer cndim = wnga_ndim(c);
4869 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4870 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4871 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4872 COPYINDEX_C2F(alo,_ga_alo, andim);
4873 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4874 COPYINDEX_C2F(blo,_ga_blo, bndim);
4875 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4876 COPYINDEX_C2F(clo,_ga_clo, cndim);
4877 COPYINDEX_C2F(chi,_ga_chi, cndim);
4878 wnga_elem_minimum_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4879 }
4880
GA_Elem_minimum_patch64(int g_a,int64_t alo[],int64_t ahi[],int g_b,int64_t blo[],int64_t bhi[],int g_c,int64_t clo[],int64_t chi[])4881 void GA_Elem_minimum_patch64(int g_a, int64_t alo[], int64_t ahi[],
4882 int g_b, int64_t blo[], int64_t bhi[],
4883 int g_c, int64_t clo[], int64_t chi[])
4884 {
4885 Integer a = (Integer)g_a;
4886 Integer b = (Integer)g_b;
4887 Integer c = (Integer)g_c;
4888 Integer andim = wnga_ndim(a);
4889 Integer bndim = wnga_ndim(b);
4890 Integer cndim = wnga_ndim(c);
4891 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4892 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4893 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4894 COPYINDEX_C2F(alo,_ga_alo, andim);
4895 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4896 COPYINDEX_C2F(blo,_ga_blo, bndim);
4897 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4898 COPYINDEX_C2F(clo,_ga_clo, cndim);
4899 COPYINDEX_C2F(chi,_ga_chi, cndim);
4900 wnga_elem_minimum_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi);
4901 }
4902
GA_Shift_diagonal(int g_a,void * c)4903 void GA_Shift_diagonal(int g_a, void *c){
4904 Integer a = (Integer )g_a;
4905 wnga_shift_diagonal(a, c);
4906 }
4907
GA_Set_diagonal(int g_a,int g_v)4908 void GA_Set_diagonal(int g_a, int g_v){
4909 Integer a = (Integer )g_a;
4910 Integer v = (Integer )g_v;
4911 wnga_set_diagonal(a, v);
4912 }
4913
GA_Zero_diagonal(int g_a)4914 void GA_Zero_diagonal(int g_a){
4915 Integer a = (Integer )g_a;
4916 wnga_zero_diagonal(a);
4917 }
GA_Add_diagonal(int g_a,int g_v)4918 void GA_Add_diagonal(int g_a, int g_v){
4919 Integer a = (Integer )g_a;
4920 Integer v = (Integer )g_v;
4921 wnga_add_diagonal(a, v);
4922 }
4923
GA_Get_diag(int g_a,int g_v)4924 void GA_Get_diag(int g_a, int g_v){
4925 Integer a = (Integer )g_a;
4926 Integer v = (Integer )g_v;
4927 wnga_get_diag(a, v);
4928 }
4929
GA_Scale_rows(int g_a,int g_v)4930 void GA_Scale_rows(int g_a, int g_v){
4931 Integer a = (Integer )g_a;
4932 Integer v = (Integer )g_v;
4933 wnga_scale_cols(a, v);
4934 }
4935
GA_Scale_cols(int g_a,int g_v)4936 void GA_Scale_cols(int g_a, int g_v){
4937 Integer a = (Integer )g_a;
4938 Integer v = (Integer )g_v;
4939 wnga_scale_rows(a, v);
4940 }
GA_Norm1(int g_a,double * nm)4941 void GA_Norm1(int g_a, double *nm){
4942 Integer a = (Integer )g_a;
4943 wnga_norm1(a, nm);
4944 }
4945
GA_Norm_infinity(int g_a,double * nm)4946 void GA_Norm_infinity(int g_a, double *nm){
4947 Integer a = (Integer )g_a;
4948 wnga_norm_infinity(a, nm);
4949 }
4950
4951
GA_Median(int g_a,int g_b,int g_c,int g_m)4952 void GA_Median(int g_a, int g_b, int g_c, int g_m){
4953 Integer a = (Integer )g_a;
4954 Integer b = (Integer )g_b;
4955 Integer c= (Integer )g_c;
4956 Integer m = (Integer )g_m;
4957 wnga_median(a, b, c, m);
4958 }
4959
GA_Median_patch(int g_a,int * alo,int * ahi,int g_b,int * blo,int * bhi,int g_c,int * clo,int * chi,int g_m,int * mlo,int * mhi)4960 void GA_Median_patch(int g_a, int *alo, int *ahi,
4961 int g_b, int *blo, int *bhi,
4962 int g_c, int *clo, int *chi,
4963 int g_m, int *mlo, int *mhi){
4964
4965 Integer a = (Integer)g_a;
4966 Integer b = (Integer)g_b;
4967 Integer c = (Integer)g_c;
4968 Integer m = (Integer )g_m;
4969 Integer andim = wnga_ndim(a);
4970 Integer bndim = wnga_ndim(b);
4971 Integer cndim = wnga_ndim(c);
4972 Integer mndim = wnga_ndim(m);
4973 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
4974 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
4975 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
4976 Integer _ga_mlo[MAXDIM], _ga_mhi[MAXDIM];
4977 COPYINDEX_C2F(alo,_ga_alo, andim);
4978 COPYINDEX_C2F(ahi,_ga_ahi, andim);
4979 COPYINDEX_C2F(blo,_ga_blo, bndim);
4980 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
4981 COPYINDEX_C2F(clo,_ga_clo, cndim);
4982 COPYINDEX_C2F(chi,_ga_chi, cndim);
4983 COPYINDEX_C2F(mlo,_ga_mlo, mndim);
4984 COPYINDEX_C2F(mhi,_ga_mhi, mndim);
4985 wnga_median_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi, m, _ga_mlo, _ga_mhi);
4986 }
4987
GA_Median_patch64(int g_a,int64_t * alo,int64_t * ahi,int g_b,int64_t * blo,int64_t * bhi,int g_c,int64_t * clo,int64_t * chi,int g_m,int64_t * mlo,int64_t * mhi)4988 void GA_Median_patch64(int g_a, int64_t *alo, int64_t *ahi,
4989 int g_b, int64_t *blo, int64_t *bhi,
4990 int g_c, int64_t *clo, int64_t *chi,
4991 int g_m, int64_t *mlo, int64_t *mhi){
4992
4993 Integer a = (Integer)g_a;
4994 Integer b = (Integer)g_b;
4995 Integer c = (Integer)g_c;
4996 Integer m = (Integer )g_m;
4997 Integer andim = wnga_ndim(a);
4998 Integer bndim = wnga_ndim(b);
4999 Integer cndim = wnga_ndim(c);
5000 Integer mndim = wnga_ndim(m);
5001 Integer _ga_alo[MAXDIM], _ga_ahi[MAXDIM];
5002 Integer _ga_blo[MAXDIM], _ga_bhi[MAXDIM];
5003 Integer _ga_clo[MAXDIM], _ga_chi[MAXDIM];
5004 Integer _ga_mlo[MAXDIM], _ga_mhi[MAXDIM];
5005 COPYINDEX_C2F(alo,_ga_alo, andim);
5006 COPYINDEX_C2F(ahi,_ga_ahi, andim);
5007 COPYINDEX_C2F(blo,_ga_blo, bndim);
5008 COPYINDEX_C2F(bhi,_ga_bhi, bndim);
5009 COPYINDEX_C2F(clo,_ga_clo, cndim);
5010 COPYINDEX_C2F(chi,_ga_chi, cndim);
5011 COPYINDEX_C2F(mlo,_ga_mlo, mndim);
5012 COPYINDEX_C2F(mhi,_ga_mhi, mndim);
5013 wnga_median_patch(a, _ga_alo, _ga_ahi, b, _ga_blo, _ga_bhi, c, _ga_clo, _ga_chi, m, _ga_mlo, _ga_mhi);
5014 }
5015
5016 /* return number of nodes being used in a cluster */
GA_Cluster_nnodes()5017 int GA_Cluster_nnodes()
5018 {
5019 return wnga_cluster_nnodes();
5020 }
5021
5022 /* returns ClusterNode id of the calling process */
GA_Cluster_nodeid()5023 int GA_Cluster_nodeid()
5024 {
5025 return wnga_cluster_nodeid();
5026 }
5027
5028 /* returns ClusterNode id of the specified process */
GA_Cluster_proc_nodeid(int proc)5029 int GA_Cluster_proc_nodeid(int proc)
5030 {
5031 Integer aproc = proc;
5032 return wnga_cluster_proc_nodeid(aproc);
5033 }
5034
5035 /* return number of processes being used on the specified node */
GA_Cluster_nprocs(int x)5036 int GA_Cluster_nprocs(int x)
5037 {
5038 Integer ax = x;
5039 return wnga_cluster_nprocs(ax);
5040 }
5041
5042 /* global id of the calling process */
GA_Cluster_procid(int node,int loc_proc)5043 int GA_Cluster_procid(int node, int loc_proc)
5044 {
5045 Integer anode = node;
5046 Integer aloc_proc = loc_proc;
5047 return wnga_cluster_procid(anode, aloc_proc);
5048 }
5049
5050 /* wrapper for timer routines */
GA_Wtime()5051 double GA_Wtime()
5052 {
5053 return (double)wnga_wtime();
5054 }
5055
NGA_Wtime()5056 double NGA_Wtime()
5057 {
5058 return (double)wnga_wtime();
5059 }
5060
GA_Set_debug(int flag)5061 void GA_Set_debug(int flag)
5062 {
5063 Integer aa;
5064 aa = (Integer)flag;
5065 wnga_set_debug(aa);
5066 }
5067
NGA_Set_debug(int flag)5068 void NGA_Set_debug(int flag)
5069 {
5070 Integer aa;
5071 aa = (Integer)flag;
5072 wnga_set_debug(aa);
5073 }
5074
GA_Get_debug()5075 int GA_Get_debug()
5076 {
5077 return (int)wnga_get_debug();
5078 }
5079
NGA_Get_debug()5080 int NGA_Get_debug()
5081 {
5082 return (int)wnga_get_debug();
5083 }
5084
5085 #ifdef ENABLE_CHECKPOINT
GA_Checkpoint(int * gas,int num)5086 void GA_Checkpoint(int* gas, int num)
5087 {
5088 wnga_checkpoint_arrays(gas,num);
5089 }
5090 #endif
5091
GA_Pgroup_absolute_id(int grp_id,int pid)5092 int GA_Pgroup_absolute_id(int grp_id, int pid) {
5093 Integer agrp_id = (Integer)grp_id;
5094 Integer apid = (Integer) pid;
5095 return (int)wnga_pgroup_absolute_id(agrp_id, apid);
5096 }
5097
NGA_Pgroup_absolute_id(int grp_id,int pid)5098 int NGA_Pgroup_absolute_id(int grp_id, int pid) {
5099 Integer agrp_id = (Integer)grp_id;
5100 Integer apid = (Integer) pid;
5101 return (int)wnga_pgroup_absolute_id(agrp_id, apid);
5102 }
5103
GA_Error(char * str,int code)5104 void GA_Error(char *str, int code)
5105 {
5106 Integer icode = code;
5107 wnga_error(str, icode);
5108 }
5109
NGA_Error(char * str,int code)5110 void NGA_Error(char *str, int code)
5111 {
5112 Integer icode = code;
5113 wnga_error(str, icode);
5114 }
5115
GA_Inquire_memory()5116 size_t GA_Inquire_memory()
5117 {
5118 return (size_t)wnga_inquire_memory();
5119 }
5120
NGA_Inquire_memory()5121 size_t NGA_Inquire_memory()
5122 {
5123 return (size_t)wnga_inquire_memory();
5124 }
5125
GA_Sync()5126 void GA_Sync()
5127 {
5128 wnga_sync();
5129 }
5130
NGA_Sync()5131 void NGA_Sync()
5132 {
5133 wnga_sync();
5134 }
5135
GA_Uses_ma()5136 int GA_Uses_ma()
5137 {
5138 return wnga_uses_ma();
5139 }
5140
NGA_Uses_ma()5141 int NGA_Uses_ma()
5142 {
5143 return wnga_uses_ma();
5144 }
5145
GA_Print_stats()5146 void GA_Print_stats()
5147 {
5148 wnga_print_stats();
5149 }
5150
GA_Init_fence()5151 void GA_Init_fence()
5152 {
5153 wnga_init_fence();
5154 }
5155
NGA_Init_fence()5156 void NGA_Init_fence()
5157 {
5158 wnga_init_fence();
5159 }
5160
GA_Fence()5161 void GA_Fence()
5162 {
5163 wnga_fence();
5164 }
5165
NGA_Fence()5166 void NGA_Fence()
5167 {
5168 wnga_fence();
5169 }
5170
GA_Nodeid()5171 int GA_Nodeid()
5172 {
5173 return wnga_nodeid();
5174 }
5175
NGA_Nodeid()5176 int NGA_Nodeid()
5177 {
5178 return wnga_nodeid();
5179 }
5180
GA_Nnodes()5181 int GA_Nnodes()
5182 {
5183 return wnga_nnodes();
5184 }
5185
NGA_Nnodes()5186 int NGA_Nnodes()
5187 {
5188 return wnga_nnodes();
5189 }
5190
copy_map(int block[],int block_ndim,int map[])5191 static Integer* copy_map(int block[], int block_ndim, int map[])
5192 {
5193 int d;
5194 int i,sum=0,capi_offset=0,map_offset=0;
5195 Integer *_ga_map_capi;
5196
5197 for (d=0; d<block_ndim; d++) {
5198 sum += block[d];
5199 }
5200
5201 _ga_map_capi = (Integer*)malloc(sum * sizeof(Integer));
5202
5203 capi_offset = sum;
5204 for (d=0; d<block_ndim; d++) {
5205 capi_offset -= block[d];
5206 for (i=0; i<block[d]; i++) {
5207 _ga_map_capi[capi_offset+i] = map[map_offset+i] + 1;
5208 }
5209 map_offset += block[d];
5210 }
5211
5212 return _ga_map_capi;
5213 }
5214
copy_map64(int64_t block[],int block_ndim,int64_t map[])5215 static Integer* copy_map64(int64_t block[], int block_ndim, int64_t map[])
5216 {
5217 int d;
5218 int64_t i,sum=0,capi_offset=0,map_offset=0;
5219 Integer *_ga_map_capi;
5220
5221 for (d=0; d<block_ndim; d++) {
5222 sum += block[d];
5223 }
5224
5225 _ga_map_capi = (Integer*)malloc(sum * sizeof(Integer));
5226
5227 capi_offset = sum;
5228 for (d=0; d<block_ndim; d++) {
5229 capi_offset -= block[d];
5230 for (i=0; i<block[d]; i++) {
5231 _ga_map_capi[capi_offset+i] = map[map_offset+i] + 1;
5232 }
5233 map_offset += block[d];
5234 }
5235
5236 return _ga_map_capi;
5237 }
5238
NGA_Register_type(size_t bytes)5239 int NGA_Register_type(size_t bytes) {
5240 return wnga_register_type(bytes);
5241 }
5242
NGA_Deregister_type(int type)5243 int NGA_Deregister_type(int type) {
5244 return wnga_deregister_type(type);
5245 }
5246
5247
NGA_Get_field(int g_a,int * lo,int * hi,int foff,int fsize,void * buf,int * ld)5248 void NGA_Get_field(int g_a, int *lo, int *hi, int foff, int fsize,
5249 void *buf, int *ld) {
5250 Integer a = (Integer)g_a;
5251 Integer andim = wnga_ndim(a);
5252 Integer _alo[MAXDIM], _ahi[MAXDIM];
5253 Integer _ld[MAXDIM];
5254 COPYINDEX_C2F(lo,_alo, andim);
5255 COPYINDEX_C2F(hi,_ahi, andim);
5256 COPYINDEX_C2F(ld, _ld, andim-1);
5257
5258 wnga_get_field(a, _alo, _ahi, foff, fsize, buf, _ld);
5259 }
5260
NGA_Nbget_field(int g_a,int * lo,int * hi,int foff,int fsize,void * buf,int * ld,ga_nbhdl_t * nbhandle)5261 void NGA_Nbget_field(int g_a, int *lo, int *hi, int foff, int fsize,
5262 void *buf, int *ld, ga_nbhdl_t *nbhandle) {
5263 Integer a = (Integer)g_a;
5264 Integer andim = wnga_ndim(a);
5265 Integer _alo[MAXDIM], _ahi[MAXDIM];
5266 Integer _ld[MAXDIM];
5267 COPYINDEX_C2F(lo,_alo, andim);
5268 COPYINDEX_C2F(hi,_ahi, andim);
5269 COPYINDEX_C2F(ld, _ld, andim-1);
5270
5271 wnga_nbget_field(a, _alo, _ahi, foff, fsize, buf, _ld, (Integer*)nbhandle);
5272 }
5273
NGA_Nbput_field(int g_a,int * lo,int * hi,int foff,int fsize,void * buf,int * ld,ga_nbhdl_t * nbhandle)5274 void NGA_Nbput_field(int g_a, int *lo, int *hi, int foff, int fsize,
5275 void *buf, int *ld, ga_nbhdl_t *nbhandle) {
5276 Integer a = (Integer)g_a;
5277 Integer andim = wnga_ndim(a);
5278 Integer _alo[MAXDIM], _ahi[MAXDIM];
5279 Integer _ld[MAXDIM];
5280 COPYINDEX_C2F(lo,_alo, andim);
5281 COPYINDEX_C2F(hi,_ahi, andim);
5282 COPYINDEX_C2F(ld, _ld, andim-1);
5283
5284 wnga_nbput_field(a, _alo, _ahi, foff, fsize, buf, _ld, (Integer*)nbhandle);
5285 }
5286
NGA_Put_field(int g_a,int * lo,int * hi,int foff,int fsize,void * buf,int * ld)5287 void NGA_Put_field(int g_a, int *lo, int *hi, int foff, int fsize,
5288 void *buf, int *ld) {
5289 Integer a = (Integer)g_a;
5290 Integer andim = wnga_ndim(a);
5291 Integer _alo[MAXDIM], _ahi[MAXDIM];
5292 Integer _ld[MAXDIM];
5293 COPYINDEX_C2F(lo,_alo, andim);
5294 COPYINDEX_C2F(hi,_ahi, andim);
5295 COPYINDEX_C2F(ld, _ld, andim-1);
5296
5297 wnga_put_field(a, _alo, _ahi, foff, fsize, buf, _ld);
5298 }
5299
GA_Version(int * major,int * minor,int * patch)5300 void GA_Version(int *major, int *minor, int *patch)
5301 {
5302 Integer maj, min, ptch;
5303 wnga_version(&maj,&min,&ptch);
5304 *major = (int)maj;
5305 *minor = (int)min;
5306 *patch = (int)ptch;
5307 }
5308
NGA_Version(int * major,int * minor,int * patch)5309 void NGA_Version(int *major, int *minor, int *patch)
5310 {
5311 Integer maj, min, ptch;
5312 wnga_version(&maj,&min,&ptch);
5313 *major = (int)maj;
5314 *minor = (int)min;
5315 *patch = (int)ptch;
5316 }
5317
5318