1
subroutine m4_func_NGA_PERIODIC_ACC(m4_test_type, m4_ndim)
9
parameter (ndim = m4_ndim)
10
m4_data_type a(substr(m4_array, 1, eval(m4_ndim*2-1)))
11
m4_data_type b(substr(m4_array, 1, eval(m4_ndim*2-1)))
12
m4_data_type c(substr(m4_array, 1, eval(m4_ndim*2-1)))
13
integer lo(ndim),hi(ndim),lop(ndim),hip(ndim)
14
integer blo(ndim),bhi(ndim)
15
integer dims(ndim),ld(ndim)
20
double precision drand
27
c---------------------- initialize the GA -----------------------
28
c initialize the chunk, dims, ld, and calculate the number
37
c*** Create global arrays
38
if (.not. nga_create(m4_MT, ndim, dims, 'a', chunk, g_a))
39
$ call ga_error(' ga_create failed ',1)
43
c------------------------ NGA_PERIODIC_ACC ----------------------
44
m4_print_info(nga_periodic_acc)
53
call m4_util_init_array(m4_test_type)(a,total)
54
call m4_util_init_array(m4_test_type)(b,total)
56
c initialize array g_a
57
call ga_fill(g_a,m4_conv(123))
60
alpha = m4_rand(me*2+1)
63
if(mod(loop,nproc).eq.me) then
64
call random_range_outbound(lo,hi,lop,hip,ndim)
65
if(Mod(loop,10).eq.0) then
66
call print_range(loop,lop,hip,ndim)
69
c keep a copy of the original patch
70
call nga_periodic_put(g_a,lop,hip,
71
$ b(substr(m4_lo_all,1,eval(m4_ndim*6-1))),ld)
74
call nga_periodic_acc(g_a,lop,hip,
75
$ a(substr(m4_lo_all,1,eval(m4_ndim*6-1))),ld,alpha)
78
call nga_periodic_get(g_a,lop,hip,
79
$ c(substr(m4_lo_all,1,eval(m4_ndim*6-1))),ld)
85
bhi(i) = hip(i)-lop(i)+1
87
c scale the local copy of array
88
call m4_util_scale_patch(m4_test_type)(total,
89
$ m4_conv(1),b,blo,bhi,ndim,dims,
90
$ alpha,a,blo,bhi,ndim,dims)
91
call m4_util_compare_patches(m4_test_type)(1d-2,
92
$ total,b,blo,bhi,ndim,dims,total,c,blo,bhi,ndim,dims)
103
c---------------------------
105
status= ga_destroy(g_a)