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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-2/armci/src/include/copy.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
/* $Id: copy.h,v 1.86.2.6 2007-08-29 17:32:32 manoj Exp $ */
 
2
#ifndef _COPY_H_
 
3
#define _COPY_H_
 
4
 
 
5
#if HAVE_STDLIB_H
 
6
#   include <stdlib.h>
 
7
#endif
 
8
#if HAVE_STRING_H
 
9
#   include <string.h>
 
10
#endif
 
11
#ifdef DECOSF
 
12
#include <c_asm.h>
 
13
#endif
 
14
 
 
15
#if 1 || defined(HITACHI) || defined(CRAY_T3E) || defined(CRAY_XT) || defined(BGML)
 
16
#  define MEMCPY
 
17
#endif
 
18
#if defined(LINUX64) && defined(SGIALTIX) && defined(MPI)
 
19
/* fastbcopy from Wayne Vieira and Gerardo Cisneros */
 
20
#define MEMCPY
 
21
#define armci_copy(src, dst, len) _fastbcopy(src, dst, len)
 
22
#define memcpy(dst, src, len)  _fastbcopy(src, dst, len)
 
23
#define bcopy(src, dst, len) _fastbcopy(src, dst, len)
 
24
#endif
 
25
 
 
26
#ifndef EXTERN
 
27
#   define EXTERN extern
 
28
#endif
 
29
 
 
30
#ifdef NEC
 
31
#  define memcpy1 _VEC_memcpy
 
32
#  define armci_copy1(src,dst,n) _VEC_memcpy((dst),(src),(n))
 
33
   EXTERN long long _armci_vec_sync_flag;
 
34
#endif
 
35
 
 
36
#if defined(SGI) || defined(FUJITSU) || defined(HPUX) || defined(SOLARIS) || defined (DECOSF) || defined(__ia64__) || defined(__crayx1)
 
37
#   define PTR_ALIGN
 
38
#endif
 
39
 
 
40
#if defined(NB_NONCONT) && !defined(CRAY_SHMEM) && !defined(QUADRICS) && !defined(PORTALS)
 
41
#error NB_NONCONT is only available on CRAY_SHMEM,QUADRICS and PORTALS
 
42
#endif
 
43
 
 
44
#if defined(SHMEM_HANDLE_SUPPORTED) && !defined(CRAY_SHMEM)
 
45
#error SHMEM_HANDLE_SUPPORTED should not be defined on a non CRAY_SHMEM network
 
46
#endif
 
47
 
 
48
#if  defined(MEMCPY)  && !defined(armci_copy)
 
49
#if defined(BGML)
 
50
#define armci_copy(src, dst, n) BGLML_memcpy((dst), (src), (n))
 
51
#else
 
52
#    define armci_copy(src,dst,n)  memcpy((dst), (src), (n)) 
 
53
#endif
 
54
#endif
 
55
 
 
56
#ifdef NEC
 
57
#    define MEM_FENCE {mpisx_clear_cache(); _armci_vec_sync_flag=1;mpisx_syncset0_long(&_armci_vec_sync_flag);}
 
58
#endif
 
59
 
 
60
#ifdef DECOSF
 
61
#    define MEM_FENCE asm ("mb")
 
62
#endif
 
63
 
 
64
#if defined(NEED_MEM_SYNC)
 
65
#  ifdef AIX
 
66
#    define MEM_FENCE {int _dummy=1; _clear_lock((int *)&_dummy,0); }
 
67
#  elif defined(__ia64)
 
68
#    if defined(__GNUC__) && !defined (__INTEL_COMPILER)
 
69
#       define MEM_FENCE __asm__ __volatile__ ("mf" ::: "memory");
 
70
#    else /* Intel Compiler */ 
 
71
        extern void _armci_ia64_mb();
 
72
#       define MEM_FENCE _armci_ia64_mb();
 
73
#    endif
 
74
#  elif defined(LINUX) && defined(__GNUC__) && defined(__ppc__)
 
75
#    define MEM_FENCE \
 
76
             __asm__ __volatile__ ("isync" : : : "memory");
 
77
#  endif
 
78
#endif
 
79
 
 
80
#ifndef armci_copy
 
81
# ifdef PTR_ALIGN
 
82
#   define armci_copy(src,dst,n)     \
 
83
     do if( ((n) < THRESH1D)   || ((n)%ALIGN_SIZE) || \
 
84
            ((unsigned long)(src)%ALIGN_SIZE) ||\
 
85
            ((unsigned long)(dst)%ALIGN_SIZE)) memcpy((dst),(src),(n));\
 
86
        else{ int _bytes=(n)/sizeof(double); DCOPY1D((double*)(src),(double*)(dst),&_bytes);}\
 
87
     while (0)
 
88
# else
 
89
#   define armci_copy(src,dst,n)     \
 
90
     do if( ((n) < THRESH1D) || ((n)%ALIGN_SIZE) ) memcpy((dst), (src), (n));\
 
91
          else{ int _bytes=(n)/sizeof(double); DCOPY1D((double*)(src),(double*)(dst),&_bytes);}\
 
92
     while (0)
 
93
# endif
 
94
#endif
 
95
 
 
96
/****************************** 2D Copy *******************/
 
97
 
 
98
 
 
99
#ifndef MEMCPY
 
100
#   define DCopy2D(rows, cols, src_ptr, src_ld, dst_ptr, dst_ld){\
 
101
      int rrows, ldd, lds, ccols;\
 
102
          rrows = (rows);\
 
103
          lds =   (src_ld);\
 
104
          ldd =   (dst_ld);\
 
105
          ccols = (cols);\
 
106
          DCOPY2D(&rrows, &ccols, src_ptr, &lds,dst_ptr,&ldd);\
 
107
      }
 
108
 
 
109
#else
 
110
#   define DCopy2D(rows, cols, src_ptr, src_ld, dst_ptr, dst_ld){\
 
111
    int j, nbytes = sizeof(double)* rows;\
 
112
    char *ps=src_ptr, *pd=dst_ptr;\
 
113
      for (j = 0;  j < cols;  j++){\
 
114
          armci_copy(ps, pd, nbytes);\
 
115
          ps += sizeof(double)* src_ld;\
 
116
          pd += sizeof(double)* dst_ld;\
 
117
      }\
 
118
    }
 
119
#endif
 
120
 
 
121
 
 
122
#   define ByteCopy2D(bytes, count, src_ptr, src_stride, dst_ptr,dst_stride){\
 
123
    int _j;\
 
124
    char *ps=src_ptr, *pd=dst_ptr;\
 
125
      for (_j = 0;  _j < count;  _j++){\
 
126
          armci_copy(ps, pd, bytes);\
 
127
          ps += src_stride;\
 
128
          pd += dst_stride;\
 
129
      }\
 
130
    }
 
131
 
 
132
#if defined(FUJITSU)
 
133
 
 
134
#   define armci_put2D(p, bytes,count,src_ptr,src_stride,dst_ptr,dst_stride)\
 
135
           CopyPatchTo(src_ptr, src_stride, dst_ptr, dst_stride, count,bytes, p)
 
136
 
 
137
#   define armci_get2D(p, bytes, count, src_ptr,src_stride,dst_ptr,dst_stride)\
 
138
           CopyPatchFrom(src_ptr, src_stride, dst_ptr, dst_stride,count,bytes,p)
 
139
 
 
140
#elif defined(HITACHI) || defined(_ELAN_PUTGET_H) && !defined(NB_NONCONT)
 
141
 
 
142
#if defined(QUADRICS)
 
143
#if 0
 
144
#   define WAIT_FOR_PUTS elan_putWaitAll(elan_base->state,200)
 
145
#   define WAIT_FOR_GETS elan_getWaitAll(elan_base->state,200)
 
146
#else
 
147
#   define WAIT_FOR_PUTS armcill_wait_put()
 
148
#   define WAIT_FOR_GETS armcill_wait_get()
 
149
    extern void armcill_wait_put();
 
150
    extern void armcill_wait_get();
 
151
#endif
 
152
#endif
 
153
 
 
154
    extern void armcill_put2D(int proc, int bytes, int count,
 
155
                void* src_ptr,int src_stride, void* dst_ptr,int dst_stride);
 
156
    extern void armcill_get2D(int proc, int bytes, int count,
 
157
                void* src_ptr,int src_stride, void* dst_ptr,int dst_stride);
 
158
#   define armci_put2D armcill_put2D
 
159
#   define armci_get2D armcill_get2D
 
160
 
 
161
#elif defined(NB_NONCONT)
 
162
 
 
163
    extern void armcill_wait_put();
 
164
    extern void armcill_wait_get();
 
165
#   define WAIT_FOR_PUTS armcill_wait_put()
 
166
#   define WAIT_FOR_GETS armcill_wait_get()
 
167
 
 
168
    extern void armcill_put2D(int proc, int bytes, int count,
 
169
                void* src_ptr,int src_stride, void* dst_ptr,int dst_stride);
 
170
    extern void armcill_get2D(int proc, int bytes, int count,
 
171
                void* src_ptr,int src_stride, void* dst_ptr,int dst_stride);
 
172
#   define armci_put2D armcill_put2D
 
173
#   define armci_get2D armcill_get2D
 
174
 
 
175
#   if   defined(QUADRICS)
 
176
 
 
177
#       define armcill_nb_put(_dst, _src, _sz, _proc, _hdl)\
 
178
               _hdl = elan_put(elan_base->state,_src,_dst,(size_t)_sz,_proc)
 
179
#       define armcill_nb_get(_dst, _src, _sz, _proc, _hdl)\
 
180
               _hdl =  elan_get(elan_base->state,_src,_dst,(size_t)_sz,_proc)
 
181
#       define armcill_nb_wait(_hdl)\
 
182
               elan_wait(_hdl,100)
 
183
 
 
184
#   elif defined(CRAY_SHMEM)
 
185
 
 
186
#       define armcill_nb_wait(_hdl)\
 
187
               shmem_wait_nb(_hdl)
 
188
/*VT:this should be ifdef'ed based on if shmem_handle is defined or not*/
 
189
#       if defined (CRAY_XT)
 
190
#           define armcill_nb_put(_dst, _src, _sz, _proc, _hdl)\
 
191
                   shmem_putmem(_dst, _src, (size_t)_sz, _proc)
 
192
#           define armcill_nb_get(_dst, _src, _sz, _proc, _hdl)\
 
193
                   shmem_getmem(_dst, _src, (size_t)_sz, _proc)
 
194
#       else
 
195
#           define armcill_nb_put(_dst, _src, _sz, _proc, _hdl)\
 
196
                   _hdl = shmem_putmem_nb(_dst, _src, (size_t)_sz, _proc, &(_hdl))
 
197
#           define armcill_nb_get(_dst, _src, _sz, _proc, _hdl)\
 
198
                   _hdl = shmem_getmem_nb(_dst, _src, (size_t)_sz, _proc, &(_hdl))
 
199
#       endif
 
200
#   endif
 
201
 
 
202
#else
 
203
#   define armci_put2D(proc,bytes,count,src_ptr,src_stride,dst_ptr,dst_stride){\
 
204
    int _j;\
 
205
    char *ps=src_ptr, *pd=dst_ptr;\
 
206
      for (_j = 0;  _j < count;  _j++){\
 
207
          armci_put(ps, pd, bytes, proc);\
 
208
          ps += src_stride;\
 
209
          pd += dst_stride;\
 
210
      }\
 
211
    }
 
212
 
 
213
 
 
214
#   define armci_get2D(proc,bytes,count,src_ptr,src_stride,dst_ptr,dst_stride){\
 
215
    int _j;\
 
216
    char *ps=src_ptr, *pd=dst_ptr;\
 
217
      for (_j = 0;  _j < count;  _j++){\
 
218
          armci_get(ps, pd, bytes, proc);\
 
219
          ps += src_stride;\
 
220
          pd += dst_stride;\
 
221
      }\
 
222
    }
 
223
#endif
 
224
   
 
225
/* macros to ensure ordering of consecutive puts or gets following puts */
 
226
#if defined(LAPI)
 
227
 
 
228
#   include "lapidefs.h"
 
229
 
 
230
#elif defined(_CRAYMPP) || defined(QUADRICS) || defined(__crayx1)\
 
231
   || defined(CRAY_SHMEM) || defined(PORTALS)
 
232
#if defined(CRAY) || defined(CRAY_XT)
 
233
#   include <mpp/shmem.h>
 
234
#else
 
235
#   include <unistd.h>
 
236
#ifndef ptrdiff_t
 
237
#   include <malloc.h>
 
238
#endif
 
239
#   include <shmem.h>
 
240
#endif
 
241
#   ifdef ELAN_ACC
 
242
#     define FENCE_NODE(p) {\
 
243
          if(((p)<armci_clus_first)||((p)>armci_clus_last))armci_elan_fence(p);}
 
244
#     define UPDATE_FENCE_STATE(p, op, nissued) 
 
245
#   else
 
246
      int cmpl_proc;
 
247
#     ifdef DECOSF
 
248
#       define FENCE_NODE(p) if(cmpl_proc == (p)){\
 
249
             if(((p)<armci_clus_first)||((p)>armci_clus_last))shmem_quiet();\
 
250
             else asm ("mb"); }
 
251
#     else
 
252
#       define FENCE_NODE(p) if(cmpl_proc == (p)){\
 
253
             if(((p)<armci_clus_first)||((p)>armci_clus_last))shmem_quiet(); }
 
254
#     endif
 
255
#     define UPDATE_FENCE_STATE(p, op, nissued) if((op)==PUT) cmpl_proc=(p);
 
256
#   endif
 
257
#else
 
258
#   if defined(GM) && defined(ACK_FENCE) 
 
259
     extern void armci_gm_fence(int p);
 
260
#    define FENCE_NODE(p) armci_gm_fence(p)
 
261
#   elif defined(BGML)
 
262
#   include "bgmldefs.h"
 
263
#   define FENCE_NODE(p) BGML_WaitProc(p)    
 
264
#   elif defined(ARMCIX)
 
265
#     define FENCE_NODE(p) ARMCIX_Fence(p) 
 
266
#   else
 
267
#     define FENCE_NODE(p)
 
268
#   endif   
 
269
#   define UPDATE_FENCE_STATE(p, op, nissued)
 
270
 
 
271
#endif
 
272
 
 
273
 
 
274
#ifdef NEC
 
275
#  define THRESH 1
 
276
#  define THRESH1D 1
 
277
#else
 
278
#  define THRESH 32
 
279
#  define THRESH1D 512
 
280
#endif
 
281
#define ALIGN_SIZE sizeof(double)
 
282
 
 
283
/********* interface to C 1D and 2D memory copy functions ***********/
 
284
/* dcopy2d_u_ uses explicit unrolled loops to depth 4 */
 
285
void c_dcopy2d_n_(const int*    const restrict rows,
 
286
                  const int*    const restrict cols,
 
287
                  const double* const restrict A,
 
288
                  const int*    const restrict ald,
 
289
                        double* const restrict B,
 
290
                  const int*    const restrict bld);
 
291
void c_dcopy2d_u_(const int*    const restrict rows,
 
292
                  const int*    const restrict cols,
 
293
                  const double* const restrict A,
 
294
                  const int*    const restrict ald,
 
295
                        double* const restrict B,
 
296
                  const int*    const restrict bld);
 
297
void c_dcopy1d_n_(const double* const restrict A,
 
298
                        double* const restrict B,
 
299
                  const int*    const restrict n);
 
300
void c_dcopy1d_u_(const double* const restrict A,
 
301
                        double* const restrict B,
 
302
                  const int*    const restrict n);
 
303
void c_dcopy21_(const int*    const restrict rows,
 
304
                const int*    const restrict cols,
 
305
                const double* const restrict A,
 
306
                const int*    const restrict ald,
 
307
                      double* const restrict buf,
 
308
                      int*    const restrict cur);
 
309
void c_dcopy12_(const int*    const restrict rows,
 
310
                const int*    const restrict cols,
 
311
                      double* const restrict A,
 
312
                const int*    const restrict ald,
 
313
                const double* const restrict buf,
 
314
                      int*    const restrict cur);
 
315
void c_dcopy31_(const int*    const restrict rows,
 
316
                const int*    const restrict cols,
 
317
                const int*    const restrict plns,
 
318
                const double* const restrict A,
 
319
                const int*    const restrict aldr,
 
320
                const int*    const restrict aldc,
 
321
                      double* const restrict buf,
 
322
                      int*    const restrict cur);
 
323
void c_dcopy13_(const int*    const restrict rows,
 
324
                const int*    const restrict cols,
 
325
                const int*    const restrict plns,
 
326
                      double* const restrict A,
 
327
                const int*    const restrict aldr,
 
328
                const int*    const restrict aldc,
 
329
                const double* const restrict buf,
 
330
                      int*    const restrict cur);
 
331
 
 
332
#if defined(AIX) || defined(BGML)
 
333
#    define DCOPY2D c_dcopy2d_u_
 
334
#    define DCOPY1D c_dcopy1d_u_
 
335
#elif defined(LINUX) || defined(__crayx1) || defined(HPUX64) || defined(DECOSF) || defined(CRAY) || defined(WIN32) || defined(HITACHI)
 
336
#    define DCOPY2D c_dcopy2d_n_
 
337
#    define DCOPY1D c_dcopy1d_n_
 
338
#else
 
339
#    define DCOPY2D c_dcopy2d_u_
 
340
#    define DCOPY1D c_dcopy1d_u_
 
341
#endif
 
342
#define DCOPY21 c_dcopy21_
 
343
#define DCOPY12 c_dcopy12_
 
344
#define DCOPY31 c_dcopy31_
 
345
#define DCOPY13 c_dcopy13_
 
346
 
 
347
 
 
348
/***************************** 1-Dimensional copy ************************/
 
349
#if defined(QUADRICS)
 
350
#   include <elan/elan.h>
 
351
 
 
352
#   if defined(_ELAN_PUTGET_H)
 
353
#      define qsw_put(src,dst,n,proc) \
 
354
        elan_wait(elan_put(elan_base->state,src,dst,n,proc),elan_base->waitType)
 
355
#      define qsw_get(src,dst,n,proc) \
 
356
        elan_wait(elan_get(elan_base->state,src,dst,n,proc),elan_base->waitType)
 
357
/*
 
358
#      define ARMCI_NB_PUT(src,dst,n,proc,phandle)\
 
359
              *(phandle)=elan_put(elan_base->state,src,dst,n,proc)
 
360
*/
 
361
#ifdef DOELAN4
 
362
extern void armci_elan_put_with_tracknotify(char *src,char *dst,int n,int proc, ELAN_EVENT **phandle);
 
363
#      define ARMCI_NB_PUT(src,dst,n,proc,phandle)\
 
364
              armci_elan_put_with_tracknotify(src,dst,n,proc,phandle)
 
365
#endif
 
366
 
 
367
#      define ARMCI_NB_GET(src,dst,n,proc,phandle)\
 
368
              *(phandle)=elan_get(elan_base->state,src,dst,n,proc)
 
369
#      define ARMCI_NB_WAIT(handle) if(handle)elan_wait(handle,elan_base->waitType) 
 
370
#      define ARMCI_NB_TEST(handle,_succ) (*(_succ))= (handle)? !elan_poll(handle,1L): 1 
 
371
#   else
 
372
#      define qsw_put(src,dst,n,proc) shmem_putmem((dst),(src),(int)(n),(proc))
 
373
#      define qsw_get(src,dst,n,proc) shmem_getmem((dst),(src),(int)(n),(proc))
 
374
#   endif
 
375
 
 
376
#   define armci_put(src,dst,n,proc)\
 
377
           if(((proc)<=armci_clus_last) && ((proc>= armci_clus_first))){\
 
378
              armci_copy(src,dst,n);\
 
379
           } else { qsw_put(src,dst,n,proc);}
 
380
#   define armci_get(src,dst,n,proc) \
 
381
           if(((proc)<=armci_clus_last) && ((proc>= armci_clus_first))){\
 
382
             armci_copy(src,dst,n);\
 
383
           } else { qsw_get((src),(dst),(int)(n),(proc));}
 
384
 
 
385
#elif defined(CRAY_T3E) || defined(CRAY_SHMEM)
 
386
#      define armci_copy_disabled(src,dst,n)\
 
387
        if((n)<256 || n%sizeof(long) ) memcpy((dst),(src),(n));\
 
388
        else {\
 
389
          shmem_put((long*)(dst),(long*)(src),(int)(n)/sizeof(long),armci_me);\
 
390
          shmem_quiet(); }
 
391
 
 
392
#      define armci_put(src,dst,n,proc) \
 
393
              shmem_put32((void *)(dst),(void *)(src),(int)(n)/4,(proc));\
 
394
              shmem_quiet()
 
395
 
 
396
#      define armci_get(src,dst,n,proc) \
 
397
              shmem_get32((void *)(dst),(void *)(src),(int)(n)/4,(proc));\
 
398
              shmem_quiet()
 
399
 
 
400
#elif  defined(HITACHI)
 
401
 
 
402
        extern void armcill_put(void *src, void *dst, int bytes, int proc);
 
403
        extern void armcill_get(void *src, void *dst, int bytes, int proc);
 
404
 
 
405
#      define armci_put(src,dst,n,proc) \
 
406
            if(((proc)<=armci_clus_last) && ((proc>= armci_clus_first))){\
 
407
               armci_copy(src,dst,n);\
 
408
            } else { armcill_put((src), (dst),(n),(proc));}
 
409
 
 
410
#      define armci_get(src,dst,n,proc)\
 
411
            if(((proc)<=armci_clus_last) && ((proc>= armci_clus_first))){\
 
412
               armci_copy(src,dst,n);\
 
413
            } else { armcill_get((src), (dst),(n),(proc));}
 
414
 
 
415
#elif  defined(FUJITSU)
 
416
 
 
417
#      include "fujitsu-vpp.h"
 
418
#      ifndef __sparc
 
419
#         define armci_copy(src,dst,n)  _MmCopy((char*)(dst), (char*)(src), (n))
 
420
#      endif
 
421
#      define armci_put  CopyTo
 
422
#      define armci_get  CopyFrom
 
423
 
 
424
#elif  defined(LAPI)
 
425
 
 
426
#      include <lapi.h>
 
427
       extern lapi_handle_t lapi_handle;
 
428
 
 
429
#      define armci_put(src,dst,n,proc)\
 
430
              if(proc==armci_me){\
 
431
                 armci_copy(src,dst,n);\
 
432
              } else {\
 
433
              if(LAPI_Put(lapi_handle, (uint)proc, (uint)n, (dst), (src),\
 
434
                NULL,&(ack_cntr[ARMCI_THREAD_IDX].cntr),&cmpl_arr[proc].cntr))\
 
435
                  ARMCI_Error("LAPI_put failed",0); else;}
 
436
 
 
437
       /**** this copy is nonblocking and requires fence to complete!!! ****/
 
438
#      define armci_get(src,dst,n,proc) \
 
439
              if(proc==armci_me){\
 
440
                 armci_copy(src,dst,n);\
 
441
              } else {\
 
442
              if(LAPI_Get(lapi_handle, (uint)proc, (uint)n, (src), (dst), \
 
443
                 NULL, &(get_cntr[ARMCI_THREAD_IDX].cntr)))\
 
444
                 ARMCI_Error("LAPI_Get failed",0);else;}
 
445
 
 
446
#      define ARMCI_NB_PUT(src,dst,n,proc,cmplt)\
 
447
              {if(LAPI_Setcntr(lapi_handle, &((cmplt)->cntr), 0))\
 
448
                  ARMCI_Error("LAPI_Setcntr in NB_PUT failed",0);\
 
449
              (cmplt)->val=1;\
 
450
              if(LAPI_Put(lapi_handle, (uint)proc, (uint)n, (dst), (src),\
 
451
                 NULL, &((cmplt)->cntr), &cmpl_arr[proc].cntr))\
 
452
                  ARMCI_Error("LAPI_put failed",0); else;}
 
453
 
 
454
#      define ARMCI_NB_GET(src,dst,n,proc,cmplt)\
 
455
              {if(LAPI_Setcntr(lapi_handle, &((cmplt)->cntr), 0))\
 
456
                  ARMCI_Error("LAPI_Setcntr in NB_GET failed",0);\
 
457
              (cmplt)->val=1;\
 
458
              if(LAPI_Get(lapi_handle, (uint)proc, (uint)n, (src), (dst), \
 
459
                 NULL, &((cmplt)->cntr)))\
 
460
                 ARMCI_Error("LAPI_Get NB_GET failed",0);else;}
 
461
 
 
462
#      define ARMCI_NB_WAIT(cmplt) CLEAR_COUNTER((cmplt))
 
463
#      define ARMCI_NB_TEST(cmplt,_succ) TEST_COUNTER((cmplt),(_succ))
 
464
       
 
465
#elif defined(PORTALS)
 
466
#      define armci_put(src,dst,n,proc) \
 
467
            if(((proc)<=armci_clus_last) && ((proc>= armci_clus_first))){\
 
468
               armci_copy(src,dst,n);\
 
469
            } else { PARMCI_Put((src), (dst),(n),(proc));}
 
470
 
 
471
#      define armci_get(src,dst,n,proc)\
 
472
            if(((proc)<=armci_clus_last) && ((proc>= armci_clus_first))){\
 
473
               armci_copy(src,dst,n);\
 
474
            } else { PARMCI_Get((src), (dst),(n),(proc));}
 
475
 
 
476
#if 0
 
477
#      define ARMCI_NB_PUT(src,dst,n,proc,cmplt)\
 
478
            nb_handle->tag=GET_NEXT_NBTAG();armci_portals_put((proc),(src),\
 
479
                            (dst),(n),cmplt,nb_handle->tag)
 
480
#      define ARMCI_NB_GET(src,dst,n,proc,cmplt)\
 
481
            nb_handle->tag=GET_NEXT_NBTAG();armci_portals_get((proc),(src),\
 
482
            (dst),(n),cmplt,nb_handle->tag)
 
483
#endif                                                              
 
484
 
 
485
#elif defined(BGML)
 
486
#define armci_get(src, dst, n, p)   PARMCI_Get(src, dst, n, p)
 
487
#define armci_put(src, dst, n, p)   PARMCI_Put(src, dst, n, p)
 
488
 
 
489
#elif defined(ARMCIX)
 
490
#define armci_get(src, dst, n, p)   PARMCI_Get(src, dst, n, p)
 
491
#define armci_put(src, dst, n, p)   PARMCI_Put(src, dst, n, p)
 
492
#define ARMCI_NB_WAIT(cmplt)        ARMCIX_Wait(&(cmplt))
 
493
#else
 
494
 
 
495
#      define armci_get(src,dst,n,p)    armci_copy((src),(dst),(n))
 
496
#      define armci_put(src,dst,n,p)    armci_copy((src),(dst),(n))
 
497
 
 
498
#endif
 
499
 
 
500
#ifndef MEM_FENCE
 
501
#   define MEM_FENCE {}
 
502
#endif
 
503
#ifndef armci_copy_fence
 
504
#   define armci_copy_fence armci_copy
 
505
#endif
 
506
 
 
507
#endif