1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
#if HAVE_CONFIG_H
# include "config.fh"
#endif
#define VERBOSE 0
#define NELEM 20
program main
implicit none
#include "global.fh"
integer nproc, me
#include "mp3.fh"
call ga_initialize()
nproc = ga_nnodes()
me = ga_nodeid()
#if VERBOSE
if (0.eq.me) then
write(6,*) 'TESTING INTEGER'
endif
#endif
call test_int()
#if VERBOSE
if (0.eq.me) then
write(6,*) 'TESTING REAL'
endif
#endif
call test_real()
#if VERBOSE
if (0.eq.me) then
write(6,*) 'TESTING DOUBLE PRECISION'
endif
#endif
call test_dbl()
#if VERBOSE
if (0.eq.me) then
write(6,*) 'TESTING COMPLEX'
endif
#endif
call test_scpl()
#if VERBOSE
if (0.eq.me) then
write(6,*) 'TESTING DOUBLE COMPLEX'
endif
#endif
call test_dcpl()
call ga_terminate()
call MP_FINALIZE()
end
subroutine test_int()
#include "global.fh"
#include "mafdecls.fh"
integer g_a
integer lo(1), dims(1), chunk(1), ld(1)
logical rc
integer buf(NELEM)
integer get(NELEM)
integer start
integer inc
start = 1
inc = 1
lo(1) = 1
dims(1) = NELEM
chunk(1) = 0
rc = nga_create(MT_INT, 1, dims, "g_a", chunk, g_a)
if (.not. rc) then
write(6,*) 'nga_create failed'
endif
call ga_patch_enum(g_a, 1, NELEM, start, inc)
call nga_get(g_a, lo, dims, get, ld)
do i = 1, NELEM
buf(i) = start + (i-1)*inc
end do
do i = 1, NELEM
if (buf(i).ne.get(i)) then
write(6,*) 'at',i,'value mismatch',buf(i),'.ne.',get(i)
call ga_error('error', i)
endif
end do
rc = ga_destroy(g_a)
if (.not. rc) then
write(6,*) 'ga_destroy failed'
endif
end
subroutine test_real()
#include "global.fh"
#include "mafdecls.fh"
integer g_a
integer lo(1), dims(1), chunk(1), ld(1)
logical rc
real buf(NELEM)
real get(NELEM)
real start
real inc
start = 1
inc = 1
lo(1) = 1
dims(1) = NELEM
chunk(1) = 0
rc = nga_create(MT_REAL, 1, dims, "g_a", chunk, g_a)
if (.not. rc) then
write(6,*) 'nga_create failed'
endif
call ga_patch_enum(g_a, 1, NELEM, start, inc)
call nga_get(g_a, lo, dims, get, ld)
do i = 1, NELEM
buf(i) = start + (i-1)*inc
end do
do i = 1, NELEM
if (buf(i).ne.get(i)) then
write(6,*) 'at',i,'value mismatch',buf(i),'.ne.',get(i)
call ga_error('error', i)
endif
end do
rc = ga_destroy(g_a)
if (.not. rc) then
write(6,*) 'ga_destroy failed'
endif
end
subroutine test_dbl()
#include "global.fh"
#include "mafdecls.fh"
integer g_a
integer lo(1), dims(1), chunk(1), ld(1)
logical rc
double precision buf(NELEM)
double precision get(NELEM)
double precision start
double precision inc
start = 1
inc = 1
lo(1) = 1
dims(1) = NELEM
chunk(1) = 0
rc = nga_create(MT_DBL, 1, dims, "g_a", chunk, g_a)
if (.not. rc) then
write(6,*) 'nga_create failed'
endif
call ga_patch_enum(g_a, 1, NELEM, start, inc)
call nga_get(g_a, lo, dims, get, ld)
do i = 1, NELEM
buf(i) = start + (i-1)*inc
end do
do i = 1, NELEM
if (buf(i).ne.get(i)) then
write(6,*) 'at',i,'value mismatch',buf(i),'.ne.',get(i)
call ga_error('error', i)
endif
end do
rc = ga_destroy(g_a)
if (.not. rc) then
write(6,*) 'ga_destroy failed'
endif
end
subroutine test_scpl()
#include "global.fh"
#include "mafdecls.fh"
integer g_a
integer lo(1), dims(1), chunk(1), ld(1)
logical rc
complex buf(NELEM)
complex get(NELEM)
complex start
complex inc
start = cmplx(1,1)
inc = cmplx(1,1)
lo(1) = 1
dims(1) = NELEM
chunk(1) = 0
rc = nga_create(MT_SCPL, 1, dims, "g_a", chunk, g_a)
if (.not. rc) then
write(6,*) 'nga_create failed'
endif
call ga_patch_enum(g_a, 1, NELEM, start, inc)
call nga_get(g_a, lo, dims, get, ld)
do i = 1, NELEM
buf(i) = start + (i-1)*inc
end do
do i = 1, NELEM
if (buf(i).ne.get(i)) then
write(6,*) 'at',i,'value mismatch',buf(i),'.ne.',get(i)
call ga_error('error', i)
endif
end do
rc = ga_destroy(g_a)
if (.not. rc) then
write(6,*) 'ga_destroy failed'
endif
end
subroutine test_dcpl()
#include "global.fh"
#include "mafdecls.fh"
integer g_a
integer lo(1), dims(1), chunk(1), ld(1)
logical rc
double complex buf(NELEM)
double complex get(NELEM)
double complex start
double complex inc
start = dcmplx(1,1)
inc = dcmplx(1,1)
lo(1) = 1
dims(1) = NELEM
chunk(1) = 0
rc = nga_create(MT_DCPL, 1, dims, "g_a", chunk, g_a)
if (.not. rc) then
write(6,*) 'nga_create failed'
endif
call ga_patch_enum(g_a, 1, NELEM, start, inc)
call nga_get(g_a, lo, dims, get, ld)
do i = 1, NELEM
buf(i) = start + (i-1)*inc
end do
do i = 1, NELEM
if (buf(i).ne.get(i)) then
write(6,*) 'at',i,'value mismatch',buf(i),'.ne.',get(i)
call ga_error('error', i)
endif
end do
rc = ga_destroy(g_a)
if (.not. rc) then
write(6,*) 'ga_destroy failed'
endif
end
|