~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/ga++/src/services.h

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _SERVICES_H
2
 
#define _SERVICES_H
3
 
 
4
 
namespace GA {
5
 
 
6
 
class GlobalArray;
7
 
 
8
 
/**  
9
 
 * Creates an ndim-dimensional array using the regular distribution model 
10
 
 * and returns integer handle representing the array. 
11
 
 *
12
 
 * The array can be distributed evenly or not. The control over the 
13
 
 * distribution is accomplished by specifying chunk (block) size for all or 
14
 
 * some of array dimensions.
15
 
 *
16
 
 * For example, for a 2-dimensional array, setting chunk[0]=dim[0] gives 
17
 
 * distribution by vertical strips (chunk[0]*dims[0]); 
18
 
 * setting chunk[1]=dim[1] gives distribution by horizontal strips 
19
 
 * (chunk[1]*dims[1]). Actual chunks will be modified so that they are at 
20
 
 * least the size of the minimum and each process has either zero or one 
21
 
 * chunk. Specifying chunk[i] as <1 will cause that dimension to be 
22
 
 * distributed evenly. 
23
 
 *
24
 
 * As a convenience, when chunk is specified as NULL, the entire array is 
25
 
 * distributed evenly.
26
 
 *
27
 
 * This is a collective operation. 
28
 
 *
29
 
 * @param[in] type        data type(MT_F_DBL,MT_F_INT,MT_F_DCPL)
30
 
 * @param[in] ndim        number of array dimensions
31
 
 * @param[in] dims[ndim]  array of dimensions
32
 
 * @param[in] arrayname   a unique character string
33
 
 * @param[in] chunk[ndim] array of chunks, each element specifies 
34
 
 *                        minimum size that given dimensions should be
35
 
 *                        chunked up into
36
 
 *
37
 
 * @return pointer to GlobalArray object created; NULL if it fails
38
 
 */
39
 
GlobalArray* createGA(int type, int ndim, int dims[], char *arrayname, 
40
 
        int chunk[]);
41
 
 
42
 
/**
43
 
 * Creates an array by following the user-specified distribution and 
44
 
 * returns integer handle representing the array. 
45
 
 *
46
 
 * The distribution is specified as a Cartesian product of distributions 
47
 
 * for each dimension. The array indices start at 0. For example, the 
48
 
 * following figure demonstrates distribution of a 2-dimensional array 8x10 
49
 
 * on 6 (or more) processors. nblock[2]={3,2}, the size of map array is s=5 
50
 
 * and array map contains the following elements map={0,2,6, 0, 5}. The 
51
 
 * distribution is nonuniform because, P1 and P4 get 20 elements each and 
52
 
 * processors P0,P2,P3, and P5 only 10 elements each. 
53
 
 *        
54
 
 * <TABLE>
55
 
 * <TR> <TD>5</TD>  <TD>5</TD>  </TR>
56
 
 * <TR> <TD>P0</TD> <TD>P3</TD> <TD>2</TD> </TR>
57
 
 * <TR> <TD>P1</TD> <TD>P4</TD> <TD>4</TD> </TR>
58
 
 * <TR> <TD>P2</TD> <TD>P5</TD> <TD>2</TD> </TR>
59
 
 * </TABLE>
60
 
 *
61
 
 * This is a collective operation. 
62
 
 *
63
 
 * @param[in] arrayname   a unique character string
64
 
 * @param[in] type        MA data type (MT_F_DBL,MT_F_INT,MT_F_DCPL)
65
 
 * @param[in] ndim        number of array dimensions
66
 
 * @param[in] dims        array of dimension values
67
 
 * @param[in] block       [ndim] no. of blocks each dimension is divided into
68
 
 * @param[in] maps        [s] starting index for for each block;
69
 
 *                        the size s is a sum all elements of nblock array
70
 
 *
71
 
 * @return pointer to GlobalArray object created; NULL if it fails
72
 
 */
73
 
GlobalArray * createGA(int type, int ndim, int dims[], char *arrayname, 
74
 
        int block[], int maps[]);
75
 
 
76
 
/**
77
 
 * Creates a new array by applying all the properties of another existing 
78
 
 * array.
79
 
 *
80
 
 * This is a collective operation. 
81
 
 *
82
 
 * @param[in] arrayname a character string
83
 
 * @param[in] g_b       integer handle for reference array
84
 
 *
85
 
 * @return pointer to GlobalArray object created; NULL if it fails
86
 
 */
87
 
GlobalArray * createGA(const GlobalArray *g_b, char *arrayname);
88
 
 
89
 
/**
90
 
 * Creates a new array by applying all the properties of another existing 
91
 
 * array.
92
 
 *
93
 
 * This is a collective operation. 
94
 
 *
95
 
 * @param[in] g_b integer handle for reference array
96
 
 *
97
 
 * @return pointer to GlobalArray object created; NULL if it fails
98
 
 */
99
 
GlobalArray * createGA(const GlobalArray &g_b);
100
 
 
101
 
/**
102
 
 * Creates a 10x10 global array of type "double"(default).
103
 
 *
104
 
 * This is a collective operation. 
105
 
 *
106
 
 * @return pointer to GlobalArray object created; NULL if it fails
107
 
 */
108
 
GlobalArray * createGA();  
109
 
 
110
 
/**
111
 
 * Creates an ndim-dimensional array with a layer of ghost cells around 
112
 
 * the visible data on each processor using the regular distribution 
113
 
 * model and returns an integer handle representing the array. 
114
 
 * The array can be distributed evenly or not evenly. The control over 
115
 
 * the distribution is accomplished by specifying chunk (block) size for 
116
 
 * all or some of the array dimensions. For example, for a 2-dimensional 
117
 
 * array, setting chunk(1)=dim(1) gives distribution by vertical strips 
118
 
 * (chunk(1)*dims(1)); setting chunk(2)=dim(2) gives distribution by 
119
 
 * horizontal strips (chunk(2)*dims(2)). Actual chunks will be modified 
120
 
 * so that they are at least the size of the minimum and each process 
121
 
 * has either zero or one chunk. Specifying chunk(i) as <1 will cause
122
 
 * that dimension (i-th) to be distributed evenly. The  width of the 
123
 
 * ghost cell layer in each dimension is specified using the array 
124
 
 * width().  The local data of the global array residing on each 
125
 
 * processor will have a layer width[n] ghosts cells wide on either 
126
 
 * side of the visible data along the dimension n. 
127
 
 *
128
 
 * This is a collective operation. 
129
 
 * 
130
 
 * @param[in] array_name a unique character string
131
 
 * @param[in] type       data type (MT_DBL,MT_INT,MT_DCPL)
132
 
 * @param[in] ndim       number of array dimensions
133
 
 * @param[in] dims       [ndim] array of dimensions
134
 
 * @param[in] width      [ndim] array of ghost cell widths
135
 
 * @param[in] chunk      [ndim] array of chunks, each element specifies
136
 
 *                       minimum size that given dimensions should be
137
 
 *                       chunked up into
138
 
 *
139
 
 * @returns pointer to GlobalArray object created; NULL if it fails
140
 
 */
141
 
GlobalArray * createGA_Ghosts(int type, int ndim, int dims[], 
142
 
        int width[], char *array_name, int chunk[]);
143
 
 
144
 
/**
145
 
 * Creates an array with ghost cells by following the user-specified 
146
 
 * distribution and returns integer handle representing the array. 
147
 
 * The distribution is specified as a Cartesian product of distributions 
148
 
 * for each dimension. For example, the following figure demonstrates 
149
 
 * distribution of a 2-dimensional array 8x10 on 6 (or more) processors. 
150
 
 * nblock(2)={3,2}, the size of map array is s=5 and array map contains 
151
 
 * the following elements map={1,3,7, 1, 6}. The distribution is 
152
 
 * nonuniform because, P1 and P4 get 20 elements each and processors 
153
 
 * P0,P2,P3, and P5 only 10 elements each. 
154
 
 *
155
 
 * <TABLE>
156
 
 * <TR> <TD>5</TD>  <TD>5</TD>  </TR>
157
 
 * <TR> <TD>P0</TD> <TD>P3</TD> <TD>2</TD> </TR>
158
 
 * <TR> <TD>P1</TD> <TD>P4</TD> <TD>4</TD> </TR>
159
 
 * <TR> <TD>P2</TD> <TD>P5</TD> <TD>2</TD> </TR>
160
 
 * </TABLE>
161
 
 *
162
 
 * The array width[] is used to control the width of the ghost cell 
163
 
 * boundary around the visible data on each processor. The local data 
164
 
 * of the global array residing on each processor will have a layer 
165
 
 * width[n] ghosts cells wide on either side of the visible data along 
166
 
 * the dimension n. 
167
 
 *
168
 
 * This is a collective operation. 
169
 
 *
170
 
 * @param[in] array_name a unique character string
171
 
 * @param[in] type       data type (MT_DBL,MT_INT,MT_DCPL)
172
 
 * @param[in] ndim       number of array dimensions
173
 
 * @param[in] dims       [ndim] array of dimensions
174
 
 * @param[in] width      [ndim] array of ghost cell widths
175
 
 * @param[in] nblock     [ndim] no. of blocks each dimension is divided into
176
 
 * @param[in] map        [s] starting index for for each block;
177
 
 *                       the size s is a sum of all elements of nblock array
178
 
 *
179
 
 * @return pointer to GlobalArray object created; NULL if it fails
180
 
 */
181
 
GlobalArray * createGA_Ghosts(int type, int ndim, int dims[], 
182
 
        int width[], char *array_name, int map[], 
183
 
        int nblock[]);
184
 
 
185
 
/**
186
 
 * Broadcast from process root to all other processes a message of 
187
 
 * length lenbuf. This is operation is provided only for convenience 
188
 
 * purposes: it is available regardless of the message-passing library 
189
 
 * that GA is running with. 
190
 
 *
191
 
 * This is a collective operation. 
192
 
 *
193
 
 * @param[in]     lenbuf length of buffer
194
 
 * @param[in,out] buf    [lenbuf] data
195
 
 * @param[in]     root   root process
196
 
 */
197
 
void brdcst(void *buf, int lenbuf, int root);
198
 
 
199
 
/**
200
 
 * Returns the current value of the internal debug flag.
201
 
 *
202
 
 * This is a local operation.
203
 
 *
204
 
 * @return 0 if the debug flag is false, 1 if it is true.
205
 
 */
206
 
int getDebug();
207
 
 
208
 
/**
209
 
 * This functions returns the total number of nodes that the program is 
210
 
 * running on.
211
 
 *
212
 
 * On SMP architectures, this will be less than or equal to the total
213
 
 * number of processors. 
214
 
 *
215
 
 * This is a  local operation. 
216
 
 *
217
 
 * @return the number of nodes the program is running on
218
 
 */
219
 
int clusterNnodes();
220
 
 
221
 
/**  
222
 
 * This function returns the node ID of the process.
223
 
 *
224
 
 * On SMP architectures with more than one processor per node, several
225
 
 * processes may return the same node id. 
226
 
 *
227
 
 * This is a  local operation. 
228
 
 *
229
 
 * @return the node ID of the process
230
 
 */
231
 
int clusterNodeid();
232
 
 
233
 
/**  
234
 
 * This function returns the cluster node ID of the specified process.
235
 
 *
236
 
 * On SMP architectures with more than one processor per node, several
237
 
 * processes may return the same node id. 
238
 
 *
239
 
 * This is a  local operation. 
240
 
 *
241
 
 * @return the cluster node ID of the specified process
242
 
 */
243
 
int clusterProcNodeid(int iproc);
244
 
 
245
 
/**
246
 
 * This function returns the number of processors available on node inode. 
247
 
 *
248
 
 * This is a  local operation. 
249
 
 *
250
 
 * @param[in] inode
251
 
 *
252
 
 * @return the number of processors available on the given node
253
 
 */
254
 
int clusterNprocs(int inode);
255
 
 
256
 
/**
257
 
 * This function returns the processor id associated with node inode and 
258
 
 * the local processor id iproc.
259
 
 *
260
 
 * If node inode has N processors, then the value of iproc lies between
261
 
 * 0 and N-1. 
262
 
 *
263
 
 * This is a  local operation. 
264
 
 *
265
 
 * @param[in] inode
266
 
 * @param[in] iproc
267
 
 *
268
 
 * @return the processor ID associated with the given node and local processor
269
 
 * ID
270
 
 */
271
 
int clusterProcid(int inode, int iproc);
272
 
 
273
 
/**
274
 
 * Creates a set containing the number of mutexes.
275
 
 *
276
 
 * Mutex is a simple synchronization object used to protect Critical
277
 
 * Sections. Only one set of mutexes can exist at a time. Array of mutexes
278
 
 * can be created and destroyed as many times as needed. 
279
 
 * Mutexes are numbered: 0, ..., number -1.
280
 
 *
281
 
 * This is a collective operation. 
282
 
 *
283
 
 * @param[in] number of mutexes in mutex array
284
 
 *
285
 
 * @return 0 if the opereation succeeded or 1 when failed. 
286
 
 */
287
 
int createMutexes(int number);
288
 
 
289
 
/** 
290
 
 * Destroys the set of mutexes created with ga_create_mutexes.
291
 
 *
292
 
 * This is a collective operation. 
293
 
 *
294
 
 * @return 0 if the operation succeeded or 1 when failed. 
295
 
 */
296
 
int destroyMutexes();
297
 
 
298
 
/**
299
 
 * Double Global OPeration. 
300
 
 *
301
 
 * X(1:N) is a vector present on each process. DGOP 'sums' elements of 
302
 
 * X accross all nodes using the commutative operator OP. The result is 
303
 
 * broadcast to all nodes. Supported operations include '+', '*', 'max', 
304
 
 * 'min', 'absmax', 'absmin'. The use of lowerecase for operators is 
305
 
 * necessary. This is operation is provided only for convenience purposes: 
306
 
 * it is available regardless of the message-passing library that GA is 
307
 
 * running with.
308
 
 *
309
 
 * This is a collective operation. 
310
 
 *
311
 
 * @param[in]     n  number of elements
312
 
 * @param[in,out] x  [n] array of elements
313
 
 * @param[in]     op operator
314
 
 */
315
 
void dgop(double x[], int n, char *op);
316
 
 
317
 
/**
318
 
 * Creates a new array by applying all the properties of another existing 
319
 
 * array.
320
 
 *
321
 
 * This is a collective operation. 
322
 
 *
323
 
 * @param[in] array_name a character string
324
 
 * @param[in] g_a        integer handle for reference array
325
 
 *
326
 
 * @return array handle; a non-zero array handle means the call was succesful. 
327
 
 */
328
 
int duplicate(int g_a, char* array_name);
329
 
 
330
 
/**
331
 
 * To be called in case of an error.
332
 
 *
333
 
 * Print an error message and an integer value that represents error code.
334
 
 * Releases some system resources. 
335
 
 * This is the required way of aborting the program execution. 
336
 
 *
337
 
 * This operation is local. 
338
 
 *
339
 
 * @param[in] message string to print
340
 
 * @param[in] code    code to print
341
 
 */
342
 
void error(const char *message, int code);
343
 
 
344
 
/**
345
 
 * Blocks the calling process until all the data transfers corresponding to 
346
 
 * GA operations called after ga_init_fence complete.
347
 
 *
348
 
 * For example, since ga_put might return before the data reaches the final
349
 
 * destination, ga_init_fence and ga_fence allow process to wait until the
350
 
 * data tranfer is fully completed: 
351
 
 *
352
 
 * @code
353
 
 *   ga_init_fence();
354
 
 *   ga_put(g_a, ...);
355
 
 *   ga_fence();
356
 
 * @endcode
357
 
 * 
358
 
 * ga_fence must be called after ga_init_fence. A barrier, ga_sync, assures 
359
 
 * completion of all data transfers and implicitly cancels all outstanding
360
 
 * ga_init_fence calls. ga_init_fence and ga_fence must be used in pairs, 
361
 
 * multiple calls to ga_fence require the same number of corresponding
362
 
 * ga_init_fence calls. ga_init_fence/ga_fence pairs can be nested. 
363
 
 * 
364
 
 * ga_fence works for multiple GA operations. For example: 
365
 
 * 
366
 
 * @code
367
 
 *   ga_init_fence();
368
 
 *   ga_put(g_a, ...);
369
 
 *   ga_scatter(g_a, ...);
370
 
 *   ga_put(g_b, ...);
371
 
 *   ga_fence();
372
 
 * @endcode
373
 
 *
374
 
 * The calling process will be blocked until data movements initiated by 
375
 
 * two calls to ga_put and one ga_scatter complete. 
376
 
 */
377
 
void fence();
378
 
 
379
 
/**
380
 
 * Integer Global OPeration.
381
 
 *
382
 
 * The integer version of ga_dgop described above, also include the bitwise OR
383
 
 * operation.  This is operation is provided only for convenience purposes: it
384
 
 * is available regardless of the message-passing library that GA is running
385
 
 * with.
386
 
 *
387
 
 * This is a collective operation. 
388
 
 *
389
 
 * @param[in]     n  number of elements
390
 
 * @param[in,out] x  [n] array of elements
391
 
 * @param[in]     op operator
392
 
 */
393
 
void gop(int x[], int n, char *op);
394
 
 
395
 
/**
396
 
 * Long Global OPeration. 
397
 
 *
398
 
 * X(1:N) is a vector present on each process. LGOP 'sums' elements of 
399
 
 * X accross all nodes using the commutative operator OP. The result is 
400
 
 * broadcast to all nodes. Supported operations include '+', '*', 'max', 
401
 
 * 'min', 'absmax', 'absmin'. The use of lowerecase for operators is 
402
 
 * necessary. This is operation is provided only for convenience purposes: 
403
 
 * it is available regardless of the message-passing library that GA is 
404
 
 * running with.
405
 
 *
406
 
 * This is a collective operation. 
407
 
 *
408
 
 * @param[in]     n  number of elements
409
 
 * @param[in,out] x  [n] array of elements
410
 
 * @param[in]     op operator
411
 
 */
412
 
void gop(long x[], int n, char *op);
413
 
 
414
 
/**
415
 
 * Float Global OPeration. 
416
 
 *
417
 
 * X(1:N) is a vector present on each process. FGOP 'sums' elements of 
418
 
 * X accross all nodes using the commutative operator OP. The result is 
419
 
 * broadcast to all nodes. Supported operations include '+', '*', 'max', 
420
 
 * 'min', 'absmax', 'absmin'. The use of lowerecase for operators is 
421
 
 * necessary. This is operation is provided only for convenience purposes: 
422
 
 * it is available regardless of the message-passing library that GA is 
423
 
 * running with.
424
 
 *
425
 
 * This is a collective operation. 
426
 
 *
427
 
 * @param[in]     n  number of elements
428
 
 * @param[in,out] x  [n] array of elements
429
 
 * @param[in]     op operator
430
 
 */
431
 
void gop(float x[], int n, char *op);
432
 
 
433
 
/**
434
 
 * Double Global OPeration. 
435
 
 *
436
 
 * X(1:N) is a vector present on each process. DGOP 'sums' elements of 
437
 
 * X accross all nodes using the commutative operator OP. The result is 
438
 
 * broadcast to all nodes. Supported operations include '+', '*', 'max', 
439
 
 * 'min', 'absmax', 'absmin'. The use of lowerecase for operators is 
440
 
 * necessary. This is operation is provided only for convenience purposes: 
441
 
 * it is available regardless of the message-passing library that GA is 
442
 
 * running with.
443
 
 *
444
 
 * This is a collective operation. 
445
 
 *
446
 
 * @param[in]     n  number of elements
447
 
 * @param[in,out] x  [n] array of elements
448
 
 * @param[in]     op operator
449
 
 */
450
 
void gop(double x[], int n, char *op);
451
 
 
452
 
/**
453
 
 * Integer Global OPeration.
454
 
 *
455
 
 * The integer (more precisely long) version of ga_dgop described above,
456
 
 * also include the bitwise OR operation. 
457
 
 * This is operation is provided only for convenience purposes: it is 
458
 
 * available regardless of the message-passing library that GA is running 
459
 
 * with.
460
 
 *
461
 
 * This is a collective operation. 
462
 
 *
463
 
 * @param[in]     n  number of elements
464
 
 * @param[in,out] x  [n] array of elements
465
 
 * @param[in]     op operator
466
 
 */
467
 
void igop(int x[], int n, char *op);
468
 
 
469
 
/**
470
 
 * Initializes tracing of completion status of data movement operations. 
471
 
 *
472
 
 * This operation is local. 
473
 
 */
474
 
void initFence();
475
 
 
476
 
/**
477
 
 * Returns amount of memory (in bytes) used in the allocated global 
478
 
 * arrays on the calling processor.
479
 
 *
480
 
 * This operation is local. 
481
 
 *
482
 
 * @return amount of memory (in bytes) used in the allocated global arrays on
483
 
 *         the calling processor
484
 
 */
485
 
size_t inquireMemory();
486
 
 
487
 
/**
488
 
 * Long Global OPeration. 
489
 
 *
490
 
 * X(1:N) is a vector present on each process. LGOP 'sums' elements of 
491
 
 * X accross all nodes using the commutative operator OP. The result is 
492
 
 * broadcast to all nodes. Supported operations include '+', '*', 'max', 
493
 
 * 'min', 'absmax', 'absmin'. The use of lowerecase for operators is 
494
 
 * necessary. This is operation is provided only for convenience purposes: 
495
 
 * it is available regardless of the message-passing library that GA is 
496
 
 * running with.
497
 
 *
498
 
 * This is a collective operation. 
499
 
 *
500
 
 * @param[in]     n  number of elements
501
 
 * @param[in,out] x  [n] array of elements
502
 
 * @param[in]     op operator
503
 
 */
504
 
void lgop(long x[], int n, char *op);
505
 
 
506
 
/**
507
 
 * Locks a mutex object identified by the mutex number. It is a fatal 
508
 
 * error for a process to attempt to lock a mutex which was already 
509
 
 * locked by this process. 
510
 
 *
511
 
 * @param[in] mutex object id
512
 
 */
513
 
void lock(int mutex);
514
 
 
515
 
/**
516
 
 * Mask the intrinsic sync operations during collective calls.
517
 
 *
518
 
 * GA Collective calls has Sync calls at the begining and ending of
519
 
 * of the call. Sometimes there may be some redundacy in sync calls, which
520
 
 * can be avoided by masking the sync operations. 
521
 
 *
522
 
 * Setting the parameters as zero will mask (disable) the call. Any non-zero 
523
 
 * value will enable the call. Initially these params are set to non-zero 
524
 
 * value.
525
 
 *
526
 
 * @param[in] first masks the sync at the begining of the collective call.
527
 
 * @param[in] last  masks the sync at the end of the collective call.
528
 
 */
529
 
void maskSync(int first, int last);
530
 
 
531
 
/**
532
 
 * If GA_uses_ma returns true, then GA_Memory_avail returns the 
533
 
 * lesser of the amount available under the GA limit and the amount 
534
 
 * available from MA (according to ma_inquire_avail operation). 
535
 
 * If no GA limit has been set, it returns what MA says is available. 
536
 
 * If ( ! GA_Uses_ma() && ! GA_Memory_limited() ) returns < 0, indicating 
537
 
 * that the bound on currently available memory cannot be determined. 
538
 
 *
539
 
 * This operation is local. 
540
 
 *
541
 
 * @return amount of memory (in bytes) left for allocation of new 
542
 
 *         global arrays on the calling processor. 
543
 
 *
544
 
 */
545
 
int memoryAvailable() ;
546
 
 
547
 
/**
548
 
 * Indicates if limit is set on memory usage in Global Arrays on the 
549
 
 * calling processor.
550
 
 * 
551
 
 * This operation is local. 
552
 
 *
553
 
 * @return 1 means "yes", "0" means "no".
554
 
 */
555
 
int memoryLimited();
556
 
 
557
 
/**
558
 
 * Force completion of a nonblocking operation locally.
559
 
 *
560
 
 * Waiting on a nonblocking put or an accumulate operation assures that data
561
 
 * was injected into the network and the user buffer can be now be reused.
562
 
 * Completing a get operation assures data has arrived into the user memory
563
 
 * and is ready for use. Wait operation ensures only local completion. Unlike
564
 
 * their blocking counterparts, the nonblocking operations are not ordered
565
 
 * with respect to the destination. Performance being one reason, the other
566
 
 * reason is that by ensuring ordering we incur additional and possibly
567
 
 * unnecessary overhead on applications that do not require their operations
568
 
 * to be ordered. For cases where ordering is necessary, it can be done by
569
 
 * calling a fence operation.  The fence operation is provided to the user to
570
 
 * confirm remote completion if needed.
571
 
 *
572
 
 * This is a local operation.
573
 
 *
574
 
 * @param[in] nbhandle nonblocking handle
575
 
 */
576
 
void nbWait(GANbhdl *nbhandle);
577
 
 
578
 
/**
579
 
 * Returns the GA process id (0, ..., ga_Nnodes()-1) of the requesting 
580
 
 * compute process.
581
 
 *
582
 
 * This operation is local. 
583
 
 *
584
 
 * @return the GA process ID of the requesting process
585
 
 */
586
 
int nodeid();
587
 
 
588
 
/**
589
 
 * Returns the number of the GA compute (user) processes. 
590
 
 *
591
 
 * This operation is local. 
592
 
 *
593
 
 * @return the number of GA processes
594
 
 */
595
 
int nodes();
596
 
 
597
 
/** 
598
 
 * Print statistical information on GA use.
599
 
 *
600
 
 * This non-collective (MIMD) operation prints information about:
601
 
 *   - number of calls to
602
 
 *     - create
603
 
 *     - duplicate
604
 
 *     - destroy
605
 
 *     - get
606
 
 *     - put
607
 
 *     - scatter
608
 
 *     - gather
609
 
 *     - read_and_inc operations
610
 
 *   - total amount of data moved in the primitive operations
611
 
 *   - amount of data moved in the primitive operations to logicaly remote
612
 
 *     locations
613
 
 *   - maximum memory consumption in global arrays
614
 
 *   - number of requests serviced in the interrupt-driven implementations
615
 
 *     by the calling process.
616
 
 *
617
 
 * This operation is local. 
618
 
 */
619
 
void printStats();
620
 
 
621
 
/**
622
 
 * This function sets an internal flag in the GA library to either true or
623
 
 * false.
624
 
 *
625
 
 * The value of this flag can be recovered at any time using the
626
 
 * getDebug function. The flag is set to false when the the GA library
627
 
 * is initialized. This can be useful in a number of debugging situations,
628
 
 * especially when examining the behavior of routines that are called in
629
 
 * multiple locations in a code. 
630
 
 *
631
 
 * This is a local operation.
632
 
 *
633
 
 * @param[in] dbg value to set internal flag
634
 
 */
635
 
void setDebug(int dbg);
636
 
 
637
 
/**
638
 
 * Sets the amount of memory to be used (in bytes) per process.
639
 
 * 
640
 
 * This is a local operation. 
641
 
 *
642
 
 * @param[in] limit the amount of memory in bytes per process
643
 
 */
644
 
void setMemoryLimit(size_t limit);
645
 
 
646
 
/** 
647
 
 * Prints info about allocated arrays. 
648
 
 *
649
 
 * @param[in] verbose if true print distribution info
650
 
 */
651
 
void summarize(int verbose);
652
 
 
653
 
/**
654
 
 * Synchronize processes (a barrier) and ensure that all GA operations 
655
 
 * completed. 
656
 
 *
657
 
 * This is a collective operation. 
658
 
 */
659
 
void sync();
660
 
 
661
 
/**
662
 
 * Unlocks a mutex object identified by the mutex number.
663
 
 *
664
 
 * It is a fatal error for a process to attempt to unlock a mutex which has
665
 
 * not been locked by this process. 
666
 
 *
667
 
 * @param[in] mutex object id
668
 
 */
669
 
void unlock(int mutex);
670
 
 
671
 
/**
672
 
 * Returns whether memory comes from internal or external allocator.
673
 
 *
674
 
 * This operation is local. 
675
 
 *
676
 
 * @return "1" if memory comes from MA;
677
 
 *         "0" if memory comes from another source e.g. System V shared memory
678
 
 */
679
 
int usesMA();
680
 
 
681
 
/**
682
 
 * Returns whether GA is using Fortran indexing.
683
 
 *
684
 
 * @return "1" if uses fortran API, else returns "0"
685
 
 */
686
 
int usesFAPI();
687
 
 
688
 
/**
689
 
 * This function return a wall (or elapsed) time on the calling processor.
690
 
 *
691
 
 * Returns time in seconds representing elapsed wall-clock time
692
 
 * since an arbitrary time in the past. Example:
693
 
 *
694
 
 * @code
695
 
 *     double starttime, endtime;
696
 
 *     starttime = GA::wtime();
697
 
 *     // {{.... code snippet to be timed ....}}
698
 
 *     endtime   = GA::wtime();
699
 
 *     printf("Time taken = %lf seconds\n", endtime-starttime);
700
 
 * @endcode
701
 
 *
702
 
 * This is a local operation.
703
 
 *
704
 
 * @note This function is only available in release 4.1 or greater.
705
 
 */
706
 
double wtime();
707
 
 
708
 
}
709
 
 
710
 
#endif /* _SERVICES_H */