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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/src-portals/strided.c

  • 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
 
#if HAVE_CONFIG_H
2
 
#   include "config.h"
3
 
#endif
4
 
 
5
 
#include <stdio.h>
6
 
#include <assert.h>
7
 
 
8
 
#include "armcip.h"
9
 
#include "copy.h"
10
 
#include "acc.h"
11
 
#include "memlock.h"
12
 
#include <stdio.h>
13
 
#include <assert.h>
14
 
 
15
 
#define DATA_SERVER_ 1
16
 
 
17
 
#ifdef ORNL_USE_DS_FOR_REMOTE_GETS
18
 
#define DATA_SERVER_GET_ 1
19
 
#else
20
 
#define DATA_SERVER_GET_ 0
21
 
#endif
22
 
 
23
 
#define ARMCI_OP_2D(op, scale, proc, src, dst, bytes, count, src_stride, dst_stride,lockit)\
24
 
if(op == GET || op ==PUT)\
25
 
      armci_copy_2D(op, proc, src, dst, bytes, count, src_stride,dst_stride);\
26
 
else if(count==1) armci_acc_1D(op, scale, proc, src, dst, bytes,lockit);\
27
 
else\
28
 
      armci_acc_2D(op, scale, proc, src, dst, bytes, count, src_stride,dst_stride,lockit) 
29
 
 
30
 
/* macro supports run-time selection of request sending scheme */
31
 
#if defined(CLIENT_BUF_BYPASS)
32
 
#define CAN_REQUEST_DIRECTLY _armci_bypass
33
 
#else
34
 
#  if defined(HITACHI)
35
 
#    define CAN_REQUEST_DIRECTLY 0
36
 
#  else
37
 
#    define CAN_REQUEST_DIRECTLY 1
38
 
#  endif
39
 
#endif
40
 
 
41
 
#define PREPROCESS_STRIDED(tmp_count) {\
42
 
 tmp_count=0;\
43
 
 if(stride_levels) \
44
 
    for(;stride_levels;stride_levels--)if(count[stride_levels]>1)break;\
45
 
 if(stride_levels&&(count[0]==src_stride_arr[0]&&count[0]==dst_stride_arr[0])){\
46
 
      tmp_count=seg_count[1];\
47
 
      count = seg_count+1;\
48
 
      seg_count[1] = seg_count[0] * seg_count[1];\
49
 
      stride_levels --;\
50
 
      src_stride_arr ++;  dst_stride_arr++ ;\
51
 
 }\
52
 
}
53
 
#define POSTPROCESS_STRIDED(tmp_count) if(tmp_count)seg_count[1]=tmp_count
54
 
 
55
 
#define SERVER_GET 1
56
 
#define SERVER_NBGET 2
57
 
#define DIRECT_GET 3
58
 
#define DIRECT_NBGET 4
59
 
#define SERVER_PUT 5
60
 
#define SERVER_NBPUT 6
61
 
#define DIRECT_PUT 7
62
 
#define DIRECT_NBPUT 8
63
 
 
64
 
 
65
 
#  define DO_FENCE(__proc,__prot) if(__prot==SERVER_GET);\
66
 
        else if(__prot==SERVER_PUT);\
67
 
        else if(__prot==DIRECT_GET || __prot==DIRECT_NBGET){\
68
 
          if(armci_prot_switch_fence[__proc]==SERVER_PUT)\
69
 
            ARMCI_DoFence(__proc);\
70
 
        }\
71
 
        else if(__prot==DIRECT_PUT || __prot==DIRECT_NBPUT){\
72
 
          if(armci_prot_switch_fence[__proc]==SERVER_PUT)\
73
 
            ARMCI_DoFence(__proc);\
74
 
        }\
75
 
        else;\
76
 
        armci_prot_switch_fence[__proc]=__prot
77
 
 
78
 
#ifndef REGIONS_REQUIRE_MEMHDL 
79
 
#  define ARMCI_MEMHDL_T void
80
 
#endif
81
 
 
82
 
ARMCI_MEMHDL_T *mhloc=NULL,*mhrem=NULL; 
83
 
 
84
 
#ifdef REGIONS_REQUIRE_MEMHDL 
85
 
   int armci_region_both_found_hndl(void *loc, void *rem, int size, int node,
86
 
                 ARMCI_MEMHDL_T **loc_memhdl,ARMCI_MEMHDL_T **rem_memhdl);
87
 
#  define ARMCI_REGION_BOTH_FOUND(_s,_d,_b,_p) \
88
 
    armci_region_both_found_hndl((_s),(_d),(_b),(_p),&mhloc,&mhrem)
89
 
#else
90
 
#  define ARMCI_REGION_BOTH_FOUND(_s,_d,_b,_p) \
91
 
    armci_region_both_found((_s),(_d),(_b),(_p))
92
 
#endif
93
 
 
94
 
#ifdef HAS_RDMA_GET
95
 
        
96
 
#  ifdef REGIONS_REQUIRE_MEMHDL 
97
 
   void armci_client_direct_get(int p, void *src_buf, void *dst_buf, int len,
98
 
         void** cptr,int nbtag,ARMCI_MEMHDL_T *lochdl,ARMCI_MEMHDL_T *remhdl);
99
 
#  else
100
 
   void armci_client_direct_get(int p, void *src_buf, void *dst_buf, int len,
101
 
                    void** contextptr,int nbtag,void *mhdl,void *mhdl1);
102
 
#  endif
103
 
#  define ARMCI_NBREM_GET(_p,_s,_sst,_d,_dst,_cou,_lev,_hdl) \
104
 
    armci_client_direct_get((_p),(_s),(_d),(_cou)[0],&((_hdl)->cmpl_info),(_hdl)->tag,(void *)mhloc,(void *)mhrem); \
105
 
 
106
 
#  define ARMCI_REM_GET(_p,_s,_sst,_d,_dst,_cou,_lev,_hdl) \
107
 
    armci_client_direct_get((_p),(_s),(_d),(_cou)[0],NULL,0,(void *)mhloc,(void *)mhrem); \
108
 
 
109
 
#else
110
 
 
111
 
#  define ARMCI_REM_GET(_p,_s,_sst,_d,_dst,_cou,_lev,_hdl) \
112
 
    armci_rem_get((_p),(_s),(_sst),(_d),(_dst),(_cou),(_lev),(_hdl),(void *)mhloc,(void *)mhrem)
113
 
#  define ARMCI_NBREM_GET ARMCI_REM_GET
114
 
        
115
 
#endif
116
 
 
117
 
 extern int* armci_prot_switch_fence;
118
 
 extern int armci_prot_switch_preproc;
119
 
 extern int armci_prot_switch_preop;
120
 
 
121
 
        
122
 
int armci_iwork[MAX_STRIDE_LEVEL];
123
 
 
124
 
/*\ 2-dimensional array copy
125
 
\*/
126
 
static void armci_copy_2D(int op, int proc, void *src_ptr, void *dst_ptr, 
127
 
                          int bytes, int count, int src_stride, int dst_stride)
128
 
{
129
 
    int armci_th_idx = ARMCI_THREAD_IDX;
130
 
    
131
 
#ifdef LAPI2__
132
 
#  define COUNT 1
133
 
#else
134
 
#  define COUNT count
135
 
#endif
136
 
 
137
 
#ifdef __crayx1
138
 
    int shmem = 1;
139
 
#else
140
 
    int shmem = SAMECLUSNODE(proc);
141
 
#endif
142
 
    if(shmem) {
143
 
      /* data is in local/shared memory -- can use memcpy */
144
 
//    printf("%s: shmem==true; count==%d\n",Portals_ID(),count);
145
 
      if(count==1){
146
 
        armci_copy(src_ptr, dst_ptr, bytes); 
147
 
//      printf("%s: shmem==true; finished\n",Portals_ID(),count);
148
 
      }else {
149
 
        char *ps=(char*)src_ptr;
150
 
        char *pd=(char*)dst_ptr;
151
 
        int j;
152
 
        for (j = 0;  j < count;  j++){
153
 
          bcopy(ps,pd,bytes);
154
 
          ps += src_stride;
155
 
          pd += dst_stride;
156
 
        }
157
 
      }
158
 
    } else {
159
 
        
160
 
        /* data not in local/shared memory-access through global address space*/
161
 
        
162
 
        if(op==PUT){ 
163
 
 
164
 
            printf("%s: pre UPDATE_FENCE_STATE\n",Portals_ID());
165
 
            UPDATE_FENCE_STATE(proc, PUT, COUNT);
166
 
            printf("%s: post UPDATE_FENCE_STATE\n",Portals_ID());
167
 
#ifdef LAPI
168
 
            SET_COUNTER(ack_cntr[armci_th_idx],COUNT);
169
 
#endif
170
 
            if(count==1){
171
 
                armci_put(src_ptr, dst_ptr, bytes, proc);
172
 
            }else{
173
 
                armci_put2D(proc, bytes, count, src_ptr, src_stride,
174
 
                            dst_ptr, dst_stride);
175
 
            }
176
 
            
177
 
        }else{
178
 
            
179
 
#ifdef LAPI
180
 
            SET_COUNTER(get_cntr[armci_th_idx], COUNT);
181
 
#endif
182
 
            if(count==1){
183
 
                armci_get(src_ptr, dst_ptr, bytes, proc);
184
 
            }else{
185
 
                armci_get2D(proc, bytes, count, src_ptr, src_stride,
186
 
                            dst_ptr, dst_stride);
187
 
            }
188
 
        }
189
 
    }
190
 
}
191
 
 
192
 
 
193
 
#if (defined(CRAY) && !defined(__crayx1)) || defined(FUJITSU)
194
 
#ifdef CRAY
195
 
#  define DAXPY  SAXPY
196
 
#else
197
 
#  define DAXPY  daxpy_
198
 
#endif
199
 
 
200
 
static int ONE=1;
201
 
#define THRESH_ACC 32
202
 
 
203
 
static void daxpy_2d_(void* alpha, int *rows, int *cols, void *a, int *ald,
204
 
               void* b, int *bld)
205
 
{
206
 
   int c,r;   
207
 
   double *A = (double*)a;
208
 
   double *B = (double*)b;
209
 
   double Alpha = *(double*)alpha;
210
 
 
211
 
   if(*rows < THRESH_ACC)
212
 
      for(c=0;c<*cols;c++)
213
 
         for(r=0;r<*rows;r++)
214
 
           A[c* *ald+ r] += Alpha * B[c* *bld+r];
215
 
   else for(c=0;c<*cols;c++)
216
 
         DAXPY(rows, alpha, B + c* *bld, &ONE, A + c* *ald, &ONE);
217
 
}
218
 
#endif
219
 
 
220
 
 
221
 
void armci_acc_1D(int op, void *scale, int proc, void *src, void *dst, int bytes, int lockit)
222
 
{
223
 
int rows;
224
 
void (ATR *func)(void*, void*, void*, int*);
225
 
    ARMCI_PR_DBG("enter",0);
226
 
      switch (op){
227
 
      case ARMCI_ACC_INT:
228
 
          rows = bytes/sizeof(int);
229
 
          func = I_ACCUMULATE_1D;
230
 
          break;
231
 
      case ARMCI_ACC_LNG:
232
 
          rows = bytes/sizeof(long);
233
 
          func = L_ACCUMULATE_1D;
234
 
          break;
235
 
      case ARMCI_ACC_DBL:
236
 
          rows = bytes/sizeof(double);
237
 
          func = D_ACCUMULATE_1D;
238
 
          break;
239
 
      case ARMCI_ACC_DCP:
240
 
          rows = bytes/(2*sizeof(double));
241
 
          func = Z_ACCUMULATE_1D;
242
 
          break;
243
 
      case ARMCI_ACC_CPL:
244
 
          rows = bytes/(2*sizeof(float));
245
 
          func = C_ACCUMULATE_1D;
246
 
          break;
247
 
      case ARMCI_ACC_FLT:
248
 
          rows = bytes/sizeof(float);
249
 
          func = F_ACCUMULATE_1D;
250
 
          break;
251
 
      default: armci_die("ARMCI accumulate: operation not supported",op);
252
 
          func = F_ACCUMULATE_1D; /*avoid compiler whining */
253
 
      }
254
 
 
255
 
 
256
 
      if(lockit){
257
 
          ARMCI_LOCKMEM(dst, bytes + (char*)dst, proc);
258
 
      }
259
 
      func(scale, dst, src, &rows);
260
 
      if(lockit)ARMCI_UNLOCKMEM(proc);
261
 
    ARMCI_PR_DBG("exit",0);
262
 
}
263
 
 
264
 
/*\ 2-dimensional accumulate
265
 
\*/
266
 
void armci_acc_2D(int op, void* scale, int proc, void *src_ptr, void *dst_ptr,
267
 
                  int bytes, int cols, int src_stride, int dst_stride, int lockit)
268
 
{
269
 
int   rows, lds, ldd, span;
270
 
void (ATR *func)(void*, int*, int*, void*, int*, void*, int*);
271
 
 
272
 
    ARMCI_PR_DBG("enter",0);
273
 
 
274
 
/*
275
 
      if((long)src_ptr%ALIGN)armci_die("src not aligned",(long)src_ptr);
276
 
      if((long)dst_ptr%ALIGN)armci_die("src not aligned",(long)dst_ptr);
277
 
*/
278
 
 
279
 
      switch (op){
280
 
      case ARMCI_ACC_INT:
281
 
          rows = bytes/sizeof(int);
282
 
          ldd  = dst_stride/sizeof(int);
283
 
          lds  = src_stride/sizeof(int);
284
 
          func = I_ACCUMULATE_2D;
285
 
          break;
286
 
      case ARMCI_ACC_LNG:
287
 
          rows = bytes/sizeof(long);
288
 
          ldd  = dst_stride/sizeof(long);
289
 
          lds  = src_stride/sizeof(long);
290
 
          func = L_ACCUMULATE_2D;
291
 
          break;
292
 
      case ARMCI_ACC_DBL:
293
 
          rows = bytes/sizeof(double);
294
 
          ldd  = dst_stride/sizeof(double);
295
 
          lds  = src_stride/sizeof(double);
296
 
          func = D_ACCUMULATE_2D;
297
 
          break;
298
 
      case ARMCI_ACC_DCP:
299
 
          rows = bytes/(2*sizeof(double));
300
 
          ldd  = dst_stride/(2*sizeof(double));
301
 
          lds  = src_stride/(2*sizeof(double));
302
 
          func = Z_ACCUMULATE_2D;
303
 
          break;
304
 
      case ARMCI_ACC_CPL:
305
 
          rows = bytes/(2*sizeof(float));
306
 
          ldd  = dst_stride/(2*sizeof(float));
307
 
          lds  = src_stride/(2*sizeof(float));
308
 
          func = C_ACCUMULATE_2D;
309
 
          break;
310
 
      case ARMCI_ACC_FLT:
311
 
          rows = bytes/sizeof(float);
312
 
          ldd  = dst_stride/sizeof(float);
313
 
          lds  = src_stride/sizeof(float);
314
 
          func = F_ACCUMULATE_2D;
315
 
          break;
316
 
      case ARMCI_ACC_RA:
317
 
          rows = bytes/sizeof(long);
318
 
          ldd  = dst_stride/sizeof(long);
319
 
          lds  = src_stride/sizeof(long);
320
 
          func = RA_ACCUMULATE_2D;
321
 
          break;
322
 
      default: armci_die("ARMCI accumulate: operation not supported",op);
323
 
          func = F_ACCUMULATE_2D; /*avoid compiler whining */
324
 
      }
325
 
 
326
 
             
327
 
      if(lockit){ 
328
 
          span = cols*dst_stride;
329
 
          ARMCI_LOCKMEM(dst_ptr, span + (char*)dst_ptr, proc);
330
 
      }
331
 
      func(scale, &rows, &cols, dst_ptr, &ldd, src_ptr, &lds);
332
 
      if(lockit)ARMCI_UNLOCKMEM(proc);
333
 
    ARMCI_PR_DBG("exit",0);
334
 
 
335
 
}
336
 
 
337
 
 
338
 
/*\ compute range of strided data AND lock it
339
 
\*/
340
 
static void 
341
 
armci_lockmem_patch(void* dst_ptr, int dst_stride_arr[], int count[], int stride_levels, int proc)
342
 
{
343
 
    long span = count[stride_levels];
344
 
    ARMCI_PR_DBG("enter",0);
345
 
    span *= dst_stride_arr[stride_levels-1];
346
 
 
347
 
    /* lock region of remote memory */
348
 
    ARMCI_LOCKMEM(dst_ptr, span + (char*)dst_ptr, proc);
349
 
    ARMCI_PR_DBG("exit",0);
350
 
}
351
 
 
352
 
 
353
 
/*\ strided accumulate on top of remote memory copy:
354
 
 *  copies remote data to local buffer, accumulates, puts it back 
355
 
 *  Note: if we are here then remote patch must fit in the ARMCI buffer
356
 
\*/
357
 
int armci_acc_copy_strided(int optype, void* scale, int proc,
358
 
                                  void* src_ptr, int src_stride_arr[],  
359
 
                                  void* dst_ptr, int dst_stride_arr[], 
360
 
                                  int count[], int stride_levels)
361
 
{
362
 
    void *buf_ptr = armci_internal_buffer;
363
 
    int  rc, i, *buf_stride_arr = armci_iwork;
364
 
    ARMCI_PR_DBG("enter",0);
365
 
    armci_lockmem_patch(dst_ptr,dst_stride_arr, count, stride_levels, proc);
366
 
 
367
 
    /* setup stride array for internal buffer */
368
 
    buf_stride_arr[0]=count[0];
369
 
    for(i=0; i< stride_levels; i++) {
370
 
         buf_stride_arr[i+1]= buf_stride_arr[i]*count[i+1];
371
 
    }
372
 
 
373
 
    /* get remote data to local buffer */
374
 
    rc = armci_op_strided(GET, scale, proc, dst_ptr, dst_stride_arr, buf_ptr, 
375
 
                          buf_stride_arr, count, stride_levels, 0,NULL);
376
 
 
377
 
    if(rc) { ARMCI_UNLOCKMEM(proc); return(rc); }
378
 
 
379
 
    /* call local accumulate with lockit=0 (we locked it already) and proc=me */
380
 
    rc = armci_op_strided(optype, scale, armci_me, src_ptr, src_stride_arr, 
381
 
                          buf_ptr,buf_stride_arr, count, stride_levels,0,NULL);
382
 
    if(rc) { ARMCI_UNLOCKMEM(proc); return(rc); }
383
 
 
384
 
    /* put data back from the buffer to remote location */
385
 
    rc = armci_op_strided(PUT, scale, proc, buf_ptr, buf_stride_arr, dst_ptr, 
386
 
                          dst_stride_arr, count, stride_levels,0,NULL);
387
 
 
388
 
    FENCE_NODE(proc); /* make sure put completes before unlocking */
389
 
    ARMCI_UNLOCKMEM(proc);    /* release memory lock */
390
 
    ARMCI_PR_DBG("exit",0);
391
 
 
392
 
    return(rc);
393
 
}
394
 
 
395
 
 
396
 
 
397
 
/*\ Strided  operation
398
 
\*/
399
 
int armci_op_strided(int op, void* scale, int proc,void *src_ptr, 
400
 
                     int src_stride_arr[], void* dst_ptr, int dst_stride_arr[], 
401
 
                     int count[], int stride_levels, int lockit,
402
 
                     armci_ihdl_t nb_handle)
403
 
{
404
 
char *src = (char*)src_ptr, *dst=(char*)dst_ptr;
405
 
int s2, s3, i,j, unlockit=0;
406
 
int total_of_2D;
407
 
int index[MAX_STRIDE_LEVEL], unit[MAX_STRIDE_LEVEL];
408
 
    ARMCI_PR_DBG("enter",op);
409
 
#   if defined(ACC_COPY)
410
 
      
411
 
#      ifdef ACC_SMP
412
 
         if(ARMCI_ACC(op) && !(SAMECLUSNODE(proc)) )
413
 
#      else
414
 
         if ( ARMCI_ACC(op) && proc!=armci_me)
415
 
#      endif
416
 
             /* copy remote data, accumulate, copy back*/
417
 
             return (armci_acc_copy_strided(op,scale, proc, src_ptr, src_stride_arr,
418
 
                                       dst_ptr, dst_stride_arr, count, stride_levels));
419
 
 
420
 
         else; /* do it directly through shared/local memory */
421
 
#   endif
422
 
 
423
 
 
424
 
      if(ARMCI_ACC(op) && (stride_levels>2) && lockit){
425
 
         /* we need one lock operation only - must be done outside 2d acc */
426
 
         armci_lockmem_patch(dst_ptr,dst_stride_arr, count, stride_levels, proc);
427
 
         unlockit=1;
428
 
         lockit =0;
429
 
      }
430
 
/*    if(proc!=armci_me) INTR_OFF;*/
431
 
    if(armci_me>=0 && !SAMECLUSNODE(proc)) {
432
 
       printf("%s network_strided not supported (in op_strided)\n",Portals_ID());
433
 
       abort();
434
 
       armci_network_strided(op,scale,proc,src_ptr,src_stride_arr,dst_ptr,
435
 
                         dst_stride_arr,count,stride_levels,nb_handle);
436
 
    }
437
 
      else {
438
 
//     printf("%s in large switch stmt in op_strided (stride_levels=%d)\n",Portals_ID(),stride_levels);
439
 
    switch (stride_levels) {
440
 
      case 0: /* 1D copy */ 
441
 
 
442
 
          ARMCI_OP_2D(op, scale, proc, src_ptr, dst_ptr, count[0], 1, 
443
 
                      count[0], count[0], lockit); 
444
 
          
445
 
          break;
446
 
          
447
 
      case 1: /* 2D op */
448
 
          ARMCI_OP_2D(op, scale, proc, src_ptr, dst_ptr, count[0], count[1], 
449
 
                      src_stride_arr[0], dst_stride_arr[0], lockit);
450
 
          break;
451
 
 
452
 
      case 2: /* 3D op */
453
 
          for (s2= 0; s2  < count[2]; s2++){ /* 2D copy */
454
 
              ARMCI_OP_2D(op, scale, proc, src+s2*src_stride_arr[1], 
455
 
                          dst+s2*dst_stride_arr[1], count[0], count[1], 
456
 
                          src_stride_arr[0], dst_stride_arr[0], lockit );
457
 
          }
458
 
          break;
459
 
          
460
 
      case 3: /* 4D op */
461
 
          for(s3=0; s3< count[3]; s3++){
462
 
              src = (char*)src_ptr + src_stride_arr[2]*s3;
463
 
              dst = (char*)dst_ptr + dst_stride_arr[2]*s3;
464
 
              for (s2= 0; s2  < count[2]; s2++){ /* 3D copy */
465
 
                  ARMCI_OP_2D(op, scale, proc, src+s2*src_stride_arr[1],
466
 
                              dst+s2*dst_stride_arr[1],
467
 
                              count[0], count[1],src_stride_arr[0],
468
 
                              dst_stride_arr[0],lockit);
469
 
              }
470
 
          }
471
 
          break;
472
 
          
473
 
      default: /* N-dimensional */ 
474
 
      {
475
 
          /* stride_levels is not the same as ndim. it is ndim-1
476
 
           * For example a 10x10x10... array, suppose the datatype is byte
477
 
           * the stride_arr is 10, 10x10, 10x10x10 ....
478
 
           */
479
 
          index[2] = 0; unit[2] = 1; total_of_2D = count[2];
480
 
          for(j=3; j<=stride_levels; j++) {
481
 
              index[j] = 0; unit[j] = unit[j-1] * count[j-1];
482
 
              total_of_2D *= count[j];
483
 
          }
484
 
 
485
 
          for(i=0; i<total_of_2D; i++) {
486
 
              src = (char *)src_ptr; dst = (char *)dst_ptr;
487
 
              for(j=2; j<=stride_levels; j++) {
488
 
                  src += index[j] * src_stride_arr[j-1];
489
 
                  dst += index[j] * dst_stride_arr[j-1];
490
 
                  
491
 
                  if(((i+1) % unit[j]) == 0) index[j]++;
492
 
                  if(index[j] >= count[j]) index[j] = 0;
493
 
              }
494
 
              
495
 
              ARMCI_OP_2D(op, scale, proc, src, dst, count[0], count[1], 
496
 
                          src_stride_arr[0], dst_stride_arr[0], lockit);
497
 
          }
498
 
          
499
 
      }
500
 
    }
501
 
    } // ends else block
502
 
 
503
 
//  printf("%s after switch stmt; prior to fence/lock\n",Portals_ID());
504
 
 
505
 
    if(unlockit){
506
 
#      if defined(ACC_COPY)
507
 
          FENCE_NODE(proc); 
508
 
#      endif
509
 
       ARMCI_UNLOCKMEM(proc);    /* release memory lock */
510
 
    }
511
 
 
512
 
//  printf("%s after fence/lock; leaving op_strided\n",Portals_ID());
513
 
    ARMCI_PR_DBG("exit",op);
514
 
    return 0;
515
 
}
516
 
 
517
 
 
518
 
int PARMCI_PutS( void *src_ptr,        /* pointer to 1st segment at source*/ 
519
 
                int src_stride_arr[], /* array of strides at source */
520
 
                void* dst_ptr,        /* pointer to 1st segment at destination*/
521
 
                int dst_stride_arr[], /* array of strides at destination */
522
 
                int seg_count[],      /* number of segments at each stride 
523
 
                                         levels: count[0]=bytes*/
524
 
                int stride_levels,    /* number of stride levels */
525
 
                int proc              /* remote process(or) ID */
526
 
                )
527
 
{
528
 
int rc=0, direct=1;
529
 
int *count=seg_count, tmp_count=0;
530
 
 
531
 
    ARMCI_PR_DBG("enter",proc);
532
 
    if(src_ptr == NULL || dst_ptr == NULL) return FAIL;
533
 
    if(count[0]<0)return FAIL3;
534
 
    if(stride_levels <0 || stride_levels > MAX_STRIDE_LEVEL) return FAIL4;
535
 
    if(proc<0)return FAIL5;
536
 
 
537
 
    ORDER(PUT,proc); /* ensure ordering */
538
 
    PREPROCESS_STRIDED(tmp_count);
539
 
 
540
 
#if DATA_SERVER_
541
 
    if(stride_levels) direct=SAMECLUSNODE(proc);
542
 
    direct=SAMECLUSNODE(proc);
543
 
#endif
544
 
 
545
 
    // printf("%s direct=%d, proc=%d\n",Portals_ID(),direct,proc);
546
 
 
547
 
    if(!direct){
548
 
       DO_FENCE(proc,SERVER_PUT);
549
 
//     printf("%s calling pack_strided in PARMCI_PutS\n",Portals_ID());
550
 
       rc = armci_pack_strided(PUT, NULL, proc, src_ptr, src_stride_arr,dst_ptr,
551
 
                  dst_stride_arr, count, stride_levels, NULL, -1, -1, -1,NULL);
552
 
    }
553
 
    else
554
 
    {
555
 
       if(!SAMECLUSNODE(proc))DO_FENCE(proc,DIRECT_PUT);
556
 
//     printf("%s calling op_strided in PARMCI_PutS\n",Portals_ID());
557
 
       rc = armci_op_strided( PUT, NULL, proc, src_ptr, src_stride_arr, 
558
 
                                 dst_ptr, dst_stride_arr,count,stride_levels, 
559
 
                                 0,NULL);
560
 
    }
561
 
    POSTPROCESS_STRIDED(tmp_count);
562
 
 
563
 
    ARMCI_PR_DBG("exit",proc);
564
 
    if(rc) return FAIL6;
565
 
    else return 0;
566
 
 
567
 
}
568
 
 
569
 
int PARMCI_PutS_flag(
570
 
      void* src_ptr,        /* pointer to 1st segment at source */
571
 
      int src_stride_arr[], /* array of strides at source */
572
 
      void* dst_ptr,        /* pointer to 1st segment at destination */
573
 
      int dst_stride_arr[], /* array of strides at destination */
574
 
      int count[],          /* number of units at each stride level,
575
 
                               count[0] = #bytes */
576
 
      int stride_levels,    /* number of stride levels */
577
 
      int *flag,            /* pointer to remote flag */
578
 
      int val,              /* value to set flag upon completion of
579
 
                               data transfer */
580
 
      int proc              /* remote process(or) ID */
581
 
      )
582
 
{
583
 
  int bytes;
584
 
  /* Put local data on remote processor */
585
 
  PARMCI_PutS(src_ptr, src_stride_arr, dst_ptr, dst_stride_arr,
586
 
             count, stride_levels, proc);
587
 
 
588
 
  /* Send signal to remote processor that data transfer has
589
 
   * been completed. */
590
 
  bytes = sizeof(int);
591
 
  ARMCI_Put(&val, flag, bytes, proc);
592
 
  return 1;
593
 
}
594
 
 
595
 
 
596
 
int PARMCI_Put_flag(void *src, void* dst,int bytes,int *f,int v,int proc) {
597
 
  return  PARMCI_PutS_flag(src, NULL, dst, NULL, &bytes, 0, f, v, proc);
598
 
}
599
 
 
600
 
 
601
 
int PARMCI_PutS_flag_dir(void *src_ptr,   int src_stride_arr[],
602
 
            void* dst_ptr,   int dst_stride_arr[],
603
 
            int seg_count[], int stride_levels,
604
 
            int *flag, int val, int proc) {
605
 
  return PARMCI_PutS_flag(src_ptr, src_stride_arr,dst_ptr,dst_stride_arr,
606
 
             seg_count, stride_levels, flag, val, proc);
607
 
}
608
 
 
609
 
 
610
 
int PARMCI_GetS( void *src_ptr,         /* pointer to 1st segment at source*/ 
611
 
                int src_stride_arr[],   /* array of strides at source */
612
 
                void* dst_ptr,          /* 1st segment at destination*/
613
 
                int dst_stride_arr[],   /* array of strides at destination */
614
 
                int seg_count[],       /* number of segments at each stride 
615
 
                                           levels: count[0]=bytes*/
616
 
                int stride_levels,      /* number of stride levels */
617
 
                int proc                /* remote process(or) ID */
618
 
                )
619
 
{
620
 
int rc,direct=1;
621
 
int *count=seg_count, tmp_count=0;
622
 
    ARMCI_PR_DBG("enter",proc);
623
 
 
624
 
    if(src_ptr == NULL || dst_ptr == NULL) return FAIL;
625
 
    if(seg_count[0]<0)return FAIL3;
626
 
    if(stride_levels <0 || stride_levels > MAX_STRIDE_LEVEL) return FAIL4;
627
 
    if(proc<0||proc>=armci_nproc){printf("\n%d:%s:proc=%d",armci_me,FUNCTION_NAME,proc);fflush(stdout);return FAIL5;}
628
 
    
629
 
    ORDER(GET,proc); /* ensure ordering */
630
 
    PREPROCESS_STRIDED(tmp_count);
631
 
 
632
 
#if DATA_SERVER_GET_
633
 
    if(stride_levels)direct=SAMECLUSNODE(proc);
634
 
    direct=SAMECLUSNODE(proc);
635
 
#endif
636
 
    if(!direct){
637
 
       DO_FENCE(proc,SERVER_GET);
638
 
       rc = armci_pack_strided(GET, NULL, proc, src_ptr, src_stride_arr,
639
 
                                 dst_ptr,dst_stride_arr,count,stride_levels,
640
 
                                 NULL,-1,-1,-1,NULL);
641
 
               
642
 
    }else{
643
 
       if(!SAMECLUSNODE(proc))DO_FENCE(proc,DIRECT_GET);
644
 
       rc = armci_op_strided(GET, NULL, proc, src_ptr, src_stride_arr, dst_ptr,
645
 
                             dst_stride_arr,count, stride_levels,0,NULL);
646
 
    }
647
 
 
648
 
    POSTPROCESS_STRIDED(tmp_count);
649
 
    ARMCI_PR_DBG("exit",proc);
650
 
    if(rc) return FAIL6;
651
 
    else return 0;
652
 
}
653
 
 
654
 
 
655
 
 
656
 
 
657
 
int PARMCI_AccS( int  optype,            /* operation */
658
 
                void *scale,            /* scale factor x += scale*y */
659
 
                void *src_ptr,          /* pointer to 1st segment at source*/ 
660
 
                int src_stride_arr[],   /* array of strides at source */
661
 
                void* dst_ptr,          /* 1st segment at destination*/
662
 
                int dst_stride_arr[],   /* array of strides at destination */
663
 
                int seg_count[],        /* number of segments at each stride 
664
 
                                           levels: count[0]=bytes*/
665
 
                int stride_levels,      /* number of stride levels */
666
 
                int proc                /* remote process(or) ID */
667
 
                )
668
 
{
669
 
int rc, direct=1;
670
 
int *count=seg_count, tmp_count=0;
671
 
 
672
 
    ARMCI_PR_DBG("enter",proc);
673
 
    if(src_ptr == NULL || dst_ptr == NULL) return FAIL;
674
 
    if(src_stride_arr == NULL || dst_stride_arr ==NULL) return FAIL2;
675
 
    if(count[0]<0)return FAIL3;
676
 
    if(stride_levels <0 || stride_levels > MAX_STRIDE_LEVEL) return FAIL4;
677
 
    if(proc<0)return FAIL5;
678
 
 
679
 
    ORDER(optype,proc); /* ensure ordering */
680
 
    PREPROCESS_STRIDED(tmp_count);
681
 
 
682
 
#if DATA_SERVER_
683
 
    direct=SAMECLUSNODE(proc);
684
 
#endif
685
 
 
686
 
#   if defined(ACC_COPY) && !defined(ACC_SMP)
687
 
       if(armci_me != proc) direct=0;
688
 
#   endif
689
 
    if(direct)
690
 
      rc = armci_op_strided(optype,scale, proc, src_ptr, src_stride_arr,dst_ptr,
691
 
                           dst_stride_arr, count, stride_levels,1,NULL);
692
 
    else{
693
 
      DO_FENCE(proc,SERVER_PUT);
694
 
      rc = armci_pack_strided(optype,scale,proc,src_ptr, src_stride_arr,dst_ptr,
695
 
                      dst_stride_arr,count,stride_levels,NULL,-1,-1,-1,NULL);
696
 
    }
697
 
    POSTPROCESS_STRIDED(tmp_count);
698
 
    ARMCI_PR_DBG("exit",proc);
699
 
    if(rc) return FAIL6;
700
 
    else return 0;
701
 
}
702
 
 
703
 
 
704
 
/* 
705
 
   whatever original put and get functions were here have been
706
 
   replaced with the proper ones from the main armci branch.
707
 
   the old functions were entirely responsible for causing the
708
 
   test_vector_acc test to fail in test.x
709
 
*/
710
 
    
711
 
int PARMCI_Put(void *src, void* dst, int bytes, int proc) {
712
 
  int rc=0;
713
 
//ARMCI_PROFILE_START_STRIDED(&bytes, 0, proc, ARMCI_PROF_PUT);
714
 
  rc = PARMCI_PutS(src, NULL, dst, NULL, &bytes, 0, proc);
715
 
//ARMCI_PROFILE_STOP_STRIDED(ARMCI_PROF_PUT);
716
 
  assert(rc==0);
717
 
  return rc;
718
 
}
719
 
 
720
 
int PARMCI_Get(void *src, void* dst, int bytes, int proc) {
721
 
  int rc=0;
722
 
//ARMCI_PROFILE_START_STRIDED(&bytes, 0, proc, ARMCI_PROF_GET);
723
 
 
724
 
#ifdef __crayx1
725
 
  memcpy(dst,src,bytes);
726
 
#else
727
 
  rc = PARMCI_GetS(src, NULL, dst, NULL, &bytes, 0, proc);
728
 
#endif
729
 
//ARMCI_PROFILE_STOP_STRIDED(ARMCI_PROF_GET);
730
 
//dassert(1,rc==0);
731
 
  assert(rc==0);
732
 
  return rc;
733
 
}
734
 
 
735
 
int PARMCI_Acc(int optype, void *scale, void *src, void* dst, int bytes, int proc) {
736
 
  int rc=0;
737
 
  rc = PARMCI_AccS(optype, scale, src, NULL, dst, NULL, &bytes, 0, proc);
738
 
  return rc;
739
 
}
740
 
 
741
 
#define PACK1D 1
742
 
 
743
 
#if PACK1D 
744
 
#  define armci_read_strided1  armci_read_strided
745
 
#  define armci_write_strided1 armci_write_strided
746
 
#else
747
 
#  define armci_read_strided2  armci_read_strided
748
 
#  define armci_write_strided2 armci_write_strided
749
 
#endif
750
 
 
751
 
void armci_write_strided1(void *ptr, int stride_levels, int stride_arr[],
752
 
                   int count[], char *buf)
753
 
{
754
 
    int i, j;
755
 
    long idx;    /* index offset of current block position to ptr */
756
 
    int n1dim;  /* number of 1 dim block */
757
 
    int bvalue[MAX_STRIDE_LEVEL], bunit[MAX_STRIDE_LEVEL];
758
 
    int bytes = count[0];
759
 
    ARMCI_PR_DBG("enter",stride_levels);
760
 
 
761
 
    /* number of n-element of the first dimension */
762
 
    n1dim = 1;
763
 
    for(i=1; i<=stride_levels; i++)
764
 
        n1dim *= count[i];
765
 
 
766
 
    /* calculate the destination indices */
767
 
    bvalue[0] = 0; bvalue[1] = 0; bunit[0] = 1; bunit[1] = 1;
768
 
    for(i=2; i<=stride_levels; i++) {
769
 
        bvalue[i] = 0;
770
 
        bunit[i] = bunit[i-1] * count[i-1];
771
 
    }
772
 
 
773
 
    for(i=0; i<n1dim; i++) {
774
 
        idx = 0;
775
 
        for(j=1; j<=stride_levels; j++) {
776
 
            idx += bvalue[j] * stride_arr[j-1];
777
 
            if((i+1) % bunit[j] == 0) bvalue[j]++;
778
 
            if(bvalue[j] > (count[j]-1)) bvalue[j] = 0;
779
 
        }
780
 
 
781
 
        armci_copy( ((char*)ptr)+idx, buf, bytes);
782
 
        buf += count[0];
783
 
    }
784
 
    ARMCI_PR_DBG("exit",stride_levels);
785
 
}
786
 
 
787
 
 
788
 
void armci_write_strided2(void *ptr, int stride_levels, int stride_arr[],
789
 
                          int count[], char *buf)
790
 
{                  
791
 
    int i, j;
792
 
    int total;   /* number of 2 dim block */
793
 
    int index[MAX_STRIDE_LEVEL], unit[MAX_STRIDE_LEVEL];
794
 
    ARMCI_PR_DBG("enter",stride_levels);
795
 
    
796
 
    if(stride_levels == 0){
797
 
       armci_copy( ptr, buf, count[0]);
798
 
    }else if (count[0]%ALIGN_SIZE || (unsigned long)ptr%ALIGN_SIZE ) 
799
 
              armci_write_strided1(ptr,stride_levels, stride_arr,count,buf);
800
 
          else {
801
 
             int rows, ld, idx, ldd;
802
 
             char *src;
803
 
             rows = count[0]/8;
804
 
             ld   = stride_arr[0]/8;
805
 
             switch(stride_levels){
806
 
             case 1: 
807
 
                     DCOPY21(&rows, count+1, ptr, &ld, buf, &idx);
808
 
                     break;
809
 
             case 2: 
810
 
                     ldd = stride_arr[1]/stride_arr[0];
811
 
                     DCOPY31(&rows, count+1, count+2, ptr, &ld, &ldd, buf,&idx);
812
 
 
813
 
                     break;
814
 
             default: 
815
 
                     index[2] = 0; unit[2] = 1; total = count[2];
816
 
                     for(j=3; j<=stride_levels; j++) {
817
 
                         index[j] = 0; unit[j] = unit[j-1] * count[j-1];
818
 
                         total *= count[j];
819
 
                     }
820
 
                     for(i=0; i<total; i++) {
821
 
                         src = (char *)ptr; 
822
 
                         for(j=2; j<=stride_levels; j++) {
823
 
                             src += index[j] * stride_arr[j-1];
824
 
                             if(((i+1) % unit[j]) == 0) index[j]++;
825
 
                             if(index[j] >= count[j]) index[j] = 0;
826
 
                         }
827
 
                         DCOPY21(&rows, count+1,src, &ld, buf, &idx); 
828
 
                         buf = (char*) ((double*)buf + idx);
829
 
                     }
830
 
            } /*switch */
831
 
         } /*else */
832
 
    ARMCI_PR_DBG("exit",stride_levels);
833
 
}
834
 
 
835
 
 
836
 
void armci_read_strided1(void *ptr, int stride_levels, int stride_arr[],
837
 
                        int count[], char *buf)
838
 
{
839
 
    int i, j;
840
 
    long idx;    /* index offset of current block position to ptr */
841
 
    int n1dim;  /* number of 1 dim block */
842
 
    int bvalue[MAX_STRIDE_LEVEL], bunit[MAX_STRIDE_LEVEL];
843
 
    int bytes = count[0];
844
 
 
845
 
    ARMCI_PR_DBG("enter",stride_levels);
846
 
    /* number of n-element of the first dimension */
847
 
    n1dim = 1;
848
 
    for(i=1; i<=stride_levels; i++)
849
 
        n1dim *= count[i];
850
 
 
851
 
    /* calculate the destination indices */
852
 
    bvalue[0] = 0; bvalue[1] = 0; bunit[0] = 1; bunit[1] = 1;
853
 
    for(i=2; i<=stride_levels; i++) {
854
 
        bvalue[i] = 0;
855
 
        bunit[i] = bunit[i-1] * count[i-1];
856
 
    }
857
 
 
858
 
    for(i=0; i<n1dim; i++) {
859
 
        idx = 0;
860
 
        for(j=1; j<=stride_levels; j++) {
861
 
            idx += bvalue[j] * stride_arr[j-1];
862
 
            if((i+1) % bunit[j] == 0) bvalue[j]++;
863
 
            if(bvalue[j] > (count[j]-1)) bvalue[j] = 0;
864
 
        }
865
 
 
866
 
        armci_copy(buf, ((char*)ptr)+idx,bytes);
867
 
        buf += count[0];
868
 
    }
869
 
    ARMCI_PR_DBG("exit",stride_levels);
870
 
}
871
 
 
872
 
 
873
 
void armci_read_strided2(void *ptr, int stride_levels, int stride_arr[],
874
 
                         int count[], char *buf)
875
 
{                  
876
 
    int i, j;
877
 
    int total;   /* number of 2 dim block */
878
 
    int index[MAX_STRIDE_LEVEL], unit[MAX_STRIDE_LEVEL];
879
 
   
880
 
    ARMCI_PR_DBG("enter",stride_levels);
881
 
    if(stride_levels == 0){
882
 
       armci_copy( buf, ptr, count[0]);
883
 
    }else if (count[0]%ALIGN_SIZE || (unsigned long)ptr%ALIGN_SIZE) 
884
 
              armci_read_strided1(ptr,stride_levels, stride_arr,count,buf);
885
 
          else {
886
 
             int rows, ld, idx, ldd;
887
 
             char *src;
888
 
             rows = count[0]/8;
889
 
             ld   = stride_arr[0]/8;
890
 
             switch(stride_levels){
891
 
             case 1: 
892
 
                     DCOPY12(&rows, count+1, ptr, &ld, buf, &idx);
893
 
                     break;
894
 
             case 2:
895
 
                     ldd = stride_arr[1]/stride_arr[0];   
896
 
                     DCOPY13(&rows, count+1, count+2, ptr, &ld, &ldd, buf,&idx);
897
 
                     break;
898
 
             default:
899
 
                     index[2] = 0; unit[2] = 1; total = count[2];
900
 
                     for(j=3; j<=stride_levels; j++) {
901
 
                         index[j] = 0; unit[j] = unit[j-1] * count[j-1];
902
 
                         total *= count[j];
903
 
                     }
904
 
                     for(i=0; i<total; i++) {
905
 
                         src = (char *)ptr; 
906
 
                         for(j=2; j<=stride_levels; j++) {
907
 
                             src += index[j] * stride_arr[j-1];
908
 
                             if(((i+1) % unit[j]) == 0) index[j]++;
909
 
                             if(index[j] >= count[j]) index[j] = 0;
910
 
                         }
911
 
                         DCOPY12(&rows, count+1,src, &ld, buf, &idx);
912
 
                         buf = (char*) ((double*)buf + idx);
913
 
                     }
914
 
            } /*switch */
915
 
         } /*else */
916
 
    ARMCI_PR_DBG("exit",stride_levels);
917
 
}
918
 
 
919
 
/*\Non-Blocking API
920
 
\*/
921
 
int PARMCI_NbPutS( void *src_ptr,        /* pointer to 1st segment at source*/ 
922
 
                int src_stride_arr[], /* array of strides at source */
923
 
                void* dst_ptr,        /* pointer to 1st segment at destination*/
924
 
                int dst_stride_arr[], /* array of strides at destination */
925
 
                int seg_count[],      /* number of segments at each stride 
926
 
                                         levels: count[0]=bytes*/
927
 
                int stride_levels,    /* number of stride levels */
928
 
                int proc,             /* remote process(or) ID */
929
 
                armci_hdl_t* usr_hdl  /* armci non-blocking call handle*/
930
 
                )
931
 
{
932
 
armci_ihdl_t nb_handle = (armci_ihdl_t)usr_hdl;
933
 
int *count=seg_count, tmp_count=0;
934
 
int rc=0, direct=1;
935
 
    ARMCI_PR_DBG("enter",proc);
936
 
    if(src_ptr == NULL || dst_ptr == NULL) return FAIL;
937
 
    if(count[0]<0)return FAIL3;
938
 
    if(stride_levels <0 || stride_levels > MAX_STRIDE_LEVEL) return FAIL4;
939
 
    if(proc<0)return FAIL5;
940
 
 
941
 
    PREPROCESS_STRIDED(tmp_count);
942
 
 
943
 
#if DATA_SERVER_
944
 
    if(stride_levels)direct=SAMECLUSNODE(proc);
945
 
    direct=SAMECLUSNODE(proc);
946
 
#endif
947
 
 
948
 
    /* aggregate put */
949
 
    if(nb_handle && nb_handle->agg_flag == SET) {
950
 
      if(!direct){ 
951
 
        rc= armci_agg_save_strided_descriptor(src_ptr, src_stride_arr, 
952
 
                                                 dst_ptr, dst_stride_arr, 
953
 
                                                 count, stride_levels, proc, 
954
 
                                                 PUT, nb_handle);
955
 
        POSTPROCESS_STRIDED(tmp_count);
956
 
        return(rc);
957
 
      }
958
 
    } 
959
 
    else {
960
 
      UPDATE_FENCE_INFO(proc);
961
 
      
962
 
      /*set tag and op in the nb handle*/
963
 
      if(nb_handle){
964
 
        nb_handle->tag = GET_NEXT_NBTAG();
965
 
        nb_handle->op  = PUT;
966
 
        nb_handle->proc= proc;
967
 
        nb_handle->bufid=NB_NONE;
968
 
      }
969
 
      else
970
 
        nb_handle = armci_set_implicit_handle(PUT, proc);
971
 
    }
972
 
 
973
 
    if(!direct){
974
 
      DO_FENCE(proc,SERVER_NBPUT);
975
 
      rc = armci_pack_strided(PUT, NULL, proc, src_ptr, src_stride_arr,dst_ptr,
976
 
                  dst_stride_arr, count, stride_levels,NULL,-1,-1,-1,nb_handle);
977
 
    }
978
 
    else{
979
 
      if(!SAMECLUSNODE(proc))DO_FENCE(proc,DIRECT_NBPUT);
980
 
      rc = armci_op_strided( PUT, NULL, proc, src_ptr, src_stride_arr,
981
 
                      dst_ptr,dst_stride_arr,count,stride_levels, 0,nb_handle);
982
 
    }
983
 
    
984
 
    POSTPROCESS_STRIDED(tmp_count);
985
 
    ARMCI_PR_DBG("exit",proc);
986
 
    if(rc) return FAIL6;
987
 
    else return 0;
988
 
}
989
 
 
990
 
int PARMCI_NbGetS( void *src_ptr,       /* pointer to 1st segment at source*/ 
991
 
                int src_stride_arr[],   /* array of strides at source */
992
 
                void* dst_ptr,          /* 1st segment at destination*/
993
 
                int dst_stride_arr[],   /* array of strides at destination */
994
 
                int seg_count[],        /* number of segments at each stride 
995
 
                                           levels: byte_count[0]=bytes*/
996
 
                int stride_levels,      /* number of stride levels */
997
 
                int proc,               /* remote process(or) ID */
998
 
                armci_hdl_t* usr_hdl  /* armci non-blocking call handle*/
999
 
                )
1000
 
{
1001
 
armci_ihdl_t nb_handle = (armci_ihdl_t)usr_hdl;
1002
 
int rc=0,direct=1;
1003
 
int *count=seg_count, tmp_count=0;
1004
 
 
1005
 
    ARMCI_PR_DBG("enter",proc);
1006
 
    if(src_ptr == NULL || dst_ptr == NULL) return FAIL;
1007
 
    if(seg_count[0]<0)return FAIL3;
1008
 
    if(stride_levels <0 || stride_levels > MAX_STRIDE_LEVEL) return FAIL4;
1009
 
    if(proc<0)return FAIL5;
1010
 
 
1011
 
#if DATA_SERVER_GET_
1012
 
    if(stride_levels)direct=SAMECLUSNODE(proc);
1013
 
    direct=SAMECLUSNODE(proc);
1014
 
#endif
1015
 
 
1016
 
    PREPROCESS_STRIDED(tmp_count);
1017
 
 
1018
 
    if(nb_handle && nb_handle->agg_flag == SET) {
1019
 
      if(!direct){ 
1020
 
        rc= armci_agg_save_strided_descriptor(src_ptr, src_stride_arr,
1021
 
                                         dst_ptr, dst_stride_arr, 
1022
 
                                         count, stride_levels, proc, 
1023
 
                                         GET, nb_handle);
1024
 
        POSTPROCESS_STRIDED(tmp_count);
1025
 
        return(rc);
1026
 
      }
1027
 
    } 
1028
 
    else {
1029
 
      /* ORDER(GET,proc); ensure ordering */
1030
 
      /*set tag and op in the nb handle*/
1031
 
      if(nb_handle){
1032
 
        nb_handle->tag = GET_NEXT_NBTAG();
1033
 
        nb_handle->op  = GET;
1034
 
        nb_handle->proc= proc;
1035
 
        nb_handle->bufid=NB_NONE;
1036
 
      }
1037
 
      else
1038
 
        nb_handle = armci_set_implicit_handle(GET, proc);
1039
 
    }
1040
 
    
1041
 
    if(!direct){
1042
 
       DO_FENCE(proc,SERVER_NBGET);
1043
 
          rc = armci_pack_strided(GET, NULL, proc, src_ptr, src_stride_arr,
1044
 
                                 dst_ptr,dst_stride_arr,count,stride_levels,
1045
 
                                 NULL,-1,-1,-1,nb_handle);
1046
 
    }
1047
 
    else{
1048
 
       if(!SAMECLUSNODE(proc))DO_FENCE(proc,DIRECT_GET);
1049
 
       rc = armci_op_strided(GET, NULL, proc, src_ptr, src_stride_arr, dst_ptr,
1050
 
                             dst_stride_arr,count, stride_levels,0,nb_handle);
1051
 
    }
1052
 
 
1053
 
    POSTPROCESS_STRIDED(tmp_count);
1054
 
 
1055
 
    ARMCI_PR_DBG("exit",proc);
1056
 
    if(rc) return FAIL6;
1057
 
    else return 0;
1058
 
}
1059
 
 
1060
 
 
1061
 
int PARMCI_NbAccS( int  optype,            /* operation */
1062
 
                void *scale,            /* scale factor x += scale*y */
1063
 
                void *src_ptr,          /* pointer to 1st segment at source*/ 
1064
 
                int src_stride_arr[],   /* array of strides at source */
1065
 
                void* dst_ptr,          /* 1st segment at destination*/
1066
 
                int dst_stride_arr[],   /* array of strides at destination */
1067
 
                int seg_count[],        /* number of segments at each stride 
1068
 
                                           levels: count[0]=bytes*/
1069
 
                int stride_levels,      /* number of stride levels */
1070
 
                int proc,               /* remote process(or) ID */
1071
 
                armci_hdl_t* usr_hdl  /* armci non-blocking call handle*/
1072
 
                )
1073
 
{
1074
 
armci_ihdl_t nb_handle = (armci_ihdl_t)usr_hdl;
1075
 
int *count=seg_count, tmp_count=0;
1076
 
int rc, direct=1;
1077
 
 
1078
 
    ARMCI_PR_DBG("enter",proc);
1079
 
    if(src_ptr == NULL || dst_ptr == NULL) return FAIL;
1080
 
    if(src_stride_arr == NULL || dst_stride_arr ==NULL) return FAIL2;
1081
 
    if(count[0]<0)return FAIL3;
1082
 
    if(stride_levels <0 || stride_levels > MAX_STRIDE_LEVEL) return FAIL4;
1083
 
    if(proc<0)return FAIL5;
1084
 
 
1085
 
    UPDATE_FENCE_INFO(proc);
1086
 
    PREPROCESS_STRIDED(tmp_count);
1087
 
    
1088
 
#if DATA_SERVER_
1089
 
    direct=SAMECLUSNODE(proc);
1090
 
#endif
1091
 
 
1092
 
#   if defined(ACC_COPY) && !defined(ACC_SMP)
1093
 
       if(armci_me != proc) direct=0;
1094
 
#   endif
1095
 
 
1096
 
    /*set tag and op in the nb handle*/
1097
 
    if(nb_handle){
1098
 
      nb_handle->tag = GET_NEXT_NBTAG();
1099
 
      nb_handle->op  = optype;
1100
 
      nb_handle->proc= proc;
1101
 
      nb_handle->bufid=NB_NONE;
1102
 
    }
1103
 
    else
1104
 
      nb_handle = armci_set_implicit_handle(optype, proc);
1105
 
 
1106
 
 
1107
 
    if(direct){
1108
 
      rc = armci_op_strided(optype,scale, proc, src_ptr, src_stride_arr,dst_ptr,
1109
 
                            dst_stride_arr, count, stride_levels,1,NULL);
1110
 
    }
1111
 
    else{
1112
 
      DO_FENCE(proc,SERVER_NBPUT);
1113
 
      rc = armci_pack_strided(optype,scale,proc,src_ptr, src_stride_arr,dst_ptr,
1114
 
                    dst_stride_arr,count,stride_levels,NULL,-1,-1,-1,nb_handle);
1115
 
    }
1116
 
 
1117
 
    POSTPROCESS_STRIDED(tmp_count);
1118
 
 
1119
 
    ARMCI_PR_DBG("exit",proc);
1120
 
    if(rc) return FAIL6;
1121
 
    else return 0;
1122
 
}
1123
 
 
1124
 
 
1125
 
#if !defined(ACC_COPY)&&!defined(CRAY_YMP)&&!defined(CYGNUS)&&!defined(CYGWIN) &&!defined(BGML)
1126
 
#   define REMOTE_OP
1127
 
#endif
1128
 
 
1129
 
#define INIT_NB_HANDLE(nb,o,p) if(nb){\
1130
 
             (nb)->tag = 0;\
1131
 
             (nb)->op  = (o); (nb)->proc= (p);\
1132
 
             (nb)->bufid=NB_NONE;}\
1133
 
             else { (nb)=armci_set_implicit_handle(o, p); (nb)->tag=0; }
1134
 
 
1135
 
void set_nbhandle(armci_ihdl_t *nbh, armci_hdl_t *nb_handle, int op,
1136
 
                         int proc)
1137
 
{
1138
 
   if(nb_handle)
1139
 
   {
1140
 
      *nbh=(armci_ihdl_t)nb_handle;
1141
 
   }
1142
 
   else
1143
 
   {
1144
 
      *nbh=armci_set_implicit_handle(op, proc);
1145
 
   }
1146
 
}
1147
 
 
1148
 
 
1149
 
int PARMCI_NbPut(void *src, void* dst, int bytes, int proc,armci_hdl_t* uhandle)
1150
 
{
1151
 
 
1152
 
int rc=0, direct=0;
1153
 
armci_ihdl_t nb_handle = (armci_ihdl_t)uhandle;
1154
 
    ARMCI_PR_DBG("enter",proc);
1155
 
    
1156
 
    if(src == NULL || dst == NULL) return FAIL;
1157
 
 
1158
 
    direct =SAMECLUSNODE(proc);
1159
 
 
1160
 
    /* aggregate put */
1161
 
    if(nb_handle && nb_handle->agg_flag == SET) {
1162
 
      if(direct) { armci_copy(src,dst,bytes); rc=0; }
1163
 
      else
1164
 
        rc=armci_agg_save_descriptor(src,dst,bytes,proc,PUT,0,nb_handle); 
1165
 
      return rc;
1166
 
    }
1167
 
 
1168
 
    if(direct) {
1169
 
      /*armci_wait needs proc to compute direct*/
1170
 
      INIT_NB_HANDLE(nb_handle,PUT,proc);
1171
 
      armci_copy(src,dst,bytes);
1172
 
    }
1173
 
    else{
1174
 
    # ifdef PORTALS
1175
 
      rc=PARMCI_NbPutS(src, NULL,dst,NULL, &bytes,0,proc,uhandle);
1176
 
    # else
1177
 
#     ifdef ARMCI_NB_PUT
1178
 
      INIT_NB_HANDLE(nb_handle,PUT,proc);
1179
 
      UPDATE_FENCE_STATE(proc, PUT, 1);
1180
 
      ARMCI_NB_PUT(src, dst, bytes, proc, &nb_handle->cmpl_info);
1181
 
#     else
1182
 
      rc=PARMCI_NbPutS(src, NULL,dst,NULL, &bytes,0,proc,uhandle);
1183
 
#     endif
1184
 
    # endif
1185
 
    }
1186
 
 
1187
 
    ARMCI_PR_DBG("exit",proc);
1188
 
    return(rc);
1189
 
}
1190
 
 
1191
 
 
1192
 
int PARMCI_NbGet(void *src, void* dst, int bytes, int proc,armci_hdl_t* uhandle)
1193
 
{
1194
 
 
1195
 
int rc=0, direct=0;
1196
 
armci_ihdl_t nb_handle = (armci_ihdl_t)uhandle;
1197
 
    ARMCI_PR_DBG("enter",proc);
1198
 
    
1199
 
    if(src == NULL || dst == NULL) return FAIL;
1200
 
 
1201
 
    direct =SAMECLUSNODE(proc);
1202
 
 
1203
 
    if(nb_handle && nb_handle->agg_flag == SET) {
1204
 
      if(direct) { armci_copy(src,dst,bytes); rc=0; }
1205
 
      else
1206
 
        rc=armci_agg_save_descriptor(src,dst,bytes,proc,GET,0,nb_handle);
1207
 
      return rc;
1208
 
    }
1209
 
 
1210
 
    if(direct) {
1211
 
      /*armci_wait needs proc to compute direct*/
1212
 
      INIT_NB_HANDLE(nb_handle,PUT,proc);
1213
 
      armci_copy(src,dst,bytes);
1214
 
    }else{
1215
 
    
1216
 
    # ifdef PORTALS
1217
 
      rc=PARMCI_NbGetS(src, NULL,dst,NULL, &bytes,0,proc,uhandle);
1218
 
    # else
1219
 
#     ifdef ARMCI_NB_GET
1220
 
      /*set tag and op in the nb handle*/
1221
 
      INIT_NB_HANDLE(nb_handle,GET,proc);
1222
 
      
1223
 
      ARMCI_NB_GET(src, dst, bytes, proc, &nb_handle->cmpl_info);
1224
 
#     else
1225
 
      rc=PARMCI_NbGetS(src, NULL,dst,NULL, &bytes,0,proc,uhandle);
1226
 
#     endif
1227
 
    # endif
1228
 
    }
1229
 
    ARMCI_PR_DBG("exit",proc);
1230
 
    return(rc);
1231
 
}
1232
 
 
1233
 
 
1234
 
static void _armci_rem_value(int op, void *src, void *dst, int proc, 
1235
 
                             int bytes) {  
1236
 
    int rc=0;
1237
 
    int armci_th_idx = ARMCI_THREAD_IDX;
1238
 
 
1239
 
    ORDER(op,proc); /* ensure ordering */
1240
 
 
1241
 
#if defined(REMOTE_OP) && !defined(QUADRICS)
1242
 
    rc = armci_rem_strided(op, NULL, proc, src, NULL, dst, NULL,
1243
 
                           &bytes, 0, NULL, 0, NULL);
1244
 
    if(rc) armci_die("ARMCI_Value: armci_rem_strided incomplete", FAIL6);
1245
 
#else
1246
 
 
1247
 
    if(op==PUT) {
1248
 
      UPDATE_FENCE_STATE(proc, PUT, 1);
1249
 
#     ifdef LAPI
1250
 
      SET_COUNTER(ack_cntr[armci_th_idx], 1);
1251
 
#     endif
1252
 
#if defined(BGML)
1253
 
      /* fprintf(stderr,"bytes: %d\n",bytes); */
1254
 
      /* this call is blocking, so local count is fine */
1255
 
      BG1S_t req;
1256
 
      unsigned count=1;
1257
 
      BGML_Callback_t cb_wait={wait_callback, &count};
1258
 
      BG1S_Memput(&req, proc, src, 0, dst, bytes, &cb_wait, 1);
1259
 
      BGML_Wait(&count);
1260
 
#else
1261
 
 
1262
 
      armci_put(src, dst, bytes, proc);
1263
 
#endif
1264
 
    }
1265
 
    else {
1266
 
#     ifdef LAPI
1267
 
      SET_COUNTER(get_cntr[armci_th_idx], 1);
1268
 
#     endif
1269
 
#if defined(BGML)
1270
 
      /* fprintf(stderr,"before memget\n"); */
1271
 
   BG1S_t req;
1272
 
   unsigned count=1;
1273
 
   BGML_Callback_t cb_wait={wait_callback, &count};
1274
 
   BG1S_Memget(&req, proc, dst, 0, src, bytes, &cb_wait, 1);
1275
 
   BGML_Wait(&count);
1276
 
 
1277
 
#else
1278
 
      armci_get(src, dst, bytes, proc);
1279
 
#endif
1280
 
    }
1281
 
    
1282
 
    /* deal with non-blocking loads and stores */
1283
 
# if defined(LAPI) || defined(_ELAN_PUTGET_H)
1284
 
    if(proc != armci_me){
1285
 
      if(op == GET){
1286
 
        WAIT_FOR_GETS; /* wait for data arrival */
1287
 
      }else {
1288
 
        WAIT_FOR_PUTS; /* data must be copied out*/
1289
 
      }
1290
 
    }
1291
 
#endif
1292
 
#endif
1293
 
}
1294
 
 
1295
 
/* non-blocking remote value put/get operation */
1296
 
static void _armci_nb_rem_value(int op, void *src, void *dst, int proc, 
1297
 
                                int bytes, armci_ihdl_t nb_handle) {  
1298
 
    int rc=0, pv=0;
1299
 
    int armci_th_idx = ARMCI_THREAD_IDX;
1300
 
 
1301
 
    if(nb_handle && nb_handle->agg_flag == SET) {
1302
 
      if(op==PUT) pv = 1;
1303
 
      (void)armci_agg_save_descriptor(src,dst,bytes,proc,op,pv,nb_handle);
1304
 
      return;
1305
 
    }
1306
 
    else {
1307
 
      if(op==PUT) UPDATE_FENCE_INFO(proc); 
1308
 
      
1309
 
      /*set tag and op in the nb handle*/
1310
 
      if(nb_handle){
1311
 
        nb_handle->tag = GET_NEXT_NBTAG();
1312
 
        nb_handle->op  = op;
1313
 
        nb_handle->proc= proc;
1314
 
        nb_handle->bufid=NB_NONE;
1315
 
      }
1316
 
      else 
1317
 
        nb_handle = armci_set_implicit_handle(op, proc);
1318
 
    }
1319
 
 
1320
 
#if defined(REMOTE_OP) && !defined(QUADRICS)
1321
 
    rc = armci_rem_strided(op, NULL, proc, src, NULL, dst, NULL,
1322
 
                           &bytes, 0, NULL, 0, nb_handle);
1323
 
    if(rc) armci_die("ARMCI_Value: armci_rem_strided incomplete", FAIL6);
1324
 
#else
1325
 
    
1326
 
    if(op==PUT) {
1327
 
      UPDATE_FENCE_STATE(proc, PUT, 1);
1328
 
#     ifdef LAPI
1329
 
      SET_COUNTER(ack_cntr[armci_th_idx], 1);
1330
 
#     endif
1331
 
      armci_put(src, dst, bytes, proc);
1332
 
    }
1333
 
    else {
1334
 
#     ifdef LAPI
1335
 
      SET_COUNTER(get_cntr[armci_th_idx], 1);
1336
 
#     endif
1337
 
      armci_get(src, dst, bytes, proc);
1338
 
    }
1339
 
    
1340
 
    /* deal with non-blocking loads and stores */
1341
 
# if defined(LAPI) || defined(_ELAN_PUTGET_H)
1342
 
#   ifdef LAPI
1343
 
    if(!nb_handle)
1344
 
#   endif
1345
 
      {
1346
 
        if(proc != armci_me){
1347
 
          if(op == GET){
1348
 
            WAIT_FOR_GETS; /* wait for data arrival */
1349
 
          }else {
1350
 
            WAIT_FOR_PUTS; /* data must be copied out*/
1351
 
          }
1352
 
        }
1353
 
      }
1354
 
# endif
1355
 
#endif
1356
 
}
1357
 
 
1358
 
 
1359
 
#define CHK_ERR(dst, proc)       \
1360
 
    if(dst==NULL) armci_die("PARMCI_PutValue: NULL pointer passed",FAIL);  \
1361
 
    if(proc<0) armci_die("PARMCI_PutValue: Invalid process rank", proc);
1362
 
 
1363
 
#define CHK_ERR_GET(src, dst, proc, bytes)       \
1364
 
    if(src==NULL || dst==NULL) armci_die("PARMCI_GetValue: NULL pointer passed",FAIL);  \
1365
 
    if(proc<0) armci_die("PARMCI_GetValue: Invalid process rank", proc); \
1366
 
    if(bytes<0) armci_die("PARMCI_GetValue: Invalid size", bytes);
1367
 
 
1368
 
/** 
1369
 
 * Register-Originated Put.
1370
 
 */
1371
 
int PARMCI_PutValueInt(int src, void *dst, int proc) 
1372
 
{
1373
 
    CHK_ERR(dst, proc);
1374
 
    if( SAMECLUSNODE(proc) ) *(int *)dst = src;
1375
 
    else _armci_rem_value(PUT, &src, dst, proc, sizeof(int));
1376
 
    return 0;
1377
 
}
1378
 
 
1379
 
int PARMCI_PutValueLong(long src, void *dst, int proc) 
1380
 
{
1381
 
    CHK_ERR(dst, proc);
1382
 
    if( SAMECLUSNODE(proc) ) *(long *)dst = src;
1383
 
    else _armci_rem_value(PUT, &src, dst, proc, sizeof(long));
1384
 
    return 0;
1385
 
}
1386
 
 
1387
 
int PARMCI_PutValueFloat(float src, void *dst, int proc) 
1388
 
{
1389
 
    CHK_ERR(dst, proc);
1390
 
    if( SAMECLUSNODE(proc) ) *(float *)dst = src;
1391
 
    else _armci_rem_value(PUT, &src, dst, proc, sizeof(float));
1392
 
    return 0;
1393
 
}
1394
 
 
1395
 
int PARMCI_PutValueDouble(double src, void *dst, int proc) 
1396
 
{
1397
 
    CHK_ERR(dst, proc);
1398
 
    if( SAMECLUSNODE(proc) ) *(double *)dst = src;
1399
 
    else _armci_rem_value(PUT, &src, dst, proc, sizeof(double));
1400
 
    return 0;
1401
 
}
1402
 
 
1403
 
/**
1404
 
 * Non-Blocking register-originated put.
1405
 
 */
1406
 
int PARMCI_NbPutValueInt(int src, void *dst, int proc, armci_hdl_t* usr_hdl) 
1407
 
{
1408
 
    CHK_ERR(dst, proc);
1409
 
    if( SAMECLUSNODE(proc) ) *(int *)dst = src;
1410
 
    else _armci_nb_rem_value(PUT,&src,dst,proc,sizeof(int),(armci_ihdl_t)usr_hdl);
1411
 
    return 0;
1412
 
}
1413
 
 
1414
 
int PARMCI_NbPutValueLong(long src, void *dst, int proc, armci_hdl_t* usr_hdl) 
1415
 
{
1416
 
    CHK_ERR(dst, proc);
1417
 
    if( SAMECLUSNODE(proc) ) *(long *)dst = src;
1418
 
    else _armci_nb_rem_value(PUT,&src,dst,proc,sizeof(long),(armci_ihdl_t)usr_hdl);
1419
 
    return 0;
1420
 
}
1421
 
 
1422
 
int PARMCI_NbPutValueFloat(float src, void *dst, int proc, armci_hdl_t* usr_hdl)
1423
 
{
1424
 
    CHK_ERR(dst, proc);
1425
 
    if( SAMECLUSNODE(proc) ) *(float *)dst = src;
1426
 
    else  _armci_nb_rem_value(PUT,&src,dst,proc,sizeof(float),(armci_ihdl_t)usr_hdl);
1427
 
    return 0;
1428
 
}
1429
 
 
1430
 
int PARMCI_NbPutValueDouble(double src, void *dst, int proc, armci_hdl_t* usr_hdl)
1431
 
{
1432
 
    CHK_ERR(dst, proc);
1433
 
    if( SAMECLUSNODE(proc) ) *(double *)dst = src;
1434
 
    else  _armci_nb_rem_value(PUT,&src,dst,proc,sizeof(double),(armci_ihdl_t)usr_hdl);
1435
 
     return 0;
1436
 
 }
1437
 
 
1438
 
#if 1
1439
 
/** 
1440
 
 * Register-Originated Get.
1441
 
 */
1442
 
int PARMCI_GetValueInt(void *src, int proc) 
1443
 
{
1444
 
    int dst;
1445
 
    if( SAMECLUSNODE(proc) ) return *(int *)src;
1446
 
    else _armci_rem_value(GET, src, &dst, proc, sizeof(int));
1447
 
    return dst;
1448
 
}
1449
 
 
1450
 
long PARMCI_GetValueLong(void *src, int proc) 
1451
 
{
1452
 
    long dst;
1453
 
    if( SAMECLUSNODE(proc) ) return *(long *)src;
1454
 
    else _armci_rem_value(GET, src, &dst, proc, sizeof(long));
1455
 
    return dst;
1456
 
}
1457
 
 
1458
 
float PARMCI_GetValueFloat(void *src, int proc) 
1459
 
{
1460
 
    float dst;
1461
 
    if( SAMECLUSNODE(proc) ) return *(float *)src;
1462
 
    else _armci_rem_value(GET, src, &dst, proc, sizeof(float));
1463
 
    return dst;
1464
 
}
1465
 
 
1466
 
double PARMCI_GetValueDouble(void *src, int proc) 
1467
 
{
1468
 
    double dst;
1469
 
    if( SAMECLUSNODE(proc) ) return *(double *)src;
1470
 
    else _armci_rem_value(GET, src, &dst, proc, sizeof(double));
1471
 
    return dst;
1472
 
}
1473
 
 
1474
 
#endif
1475
 
 
1476
 
#if 0
1477
 
/**
1478
 
 * Register-Originated Get.
1479
 
 */
1480
 
int PARMCI_GetValue(void *src, void *dst, int proc, int bytes) 
1481
 
{
1482
 
    CHK_ERR_GET(src, dst, proc, bytes);
1483
 
    if( SAMECLUSNODE(proc) ) { armci_copy(src, dst, bytes); }
1484
 
    else _armci_rem_value(GET, src, dst, proc, bytes);
1485
 
    return 0;
1486
 
}
1487
 
 
1488
 
/**
1489
 
 * Non-Blocking register-originated get.
1490
 
 */
1491
 
int PARMCI_NbGetValue(void *src, void *dst, int proc, int bytes, armci_hdl_t* usr_hdl) 
1492
 
{
1493
 
    CHK_ERR_GET(src, dst, proc, bytes);
1494
 
    if( SAMECLUSNODE(proc) ) { armci_copy(src, dst, bytes); }
1495
 
    else _armci_nb_rem_value(GET, src, dst, proc, bytes, (armci_ihdl_t)usr_hdl);
1496
 
    return 0;
1497
 
}
1498
 
#endif
1499