170
171
172
173
174#include "implicit_f.inc"
175
176
177
178#include "com01_c.inc"
179#include "com04_c.inc"
180#include "task_c.inc"
181#include "spmd_c.inc"
182#include "chara_c.inc"
183#include "units_c.inc"
184
185
186
187
188 INTEGER, INTENT(IN) :: SIZ1,SIZ2
189 INTEGER, INTENT(IN) :: A(SIZ2,SIZ1)
190
191
192
193 INTEGER, DIMENSION(:), ALLOCATABLE :: TMP
194 INTEGER :: I,CHECKSUM,ROOT,S1,S2,TWO_POWER_16
195 INTEGER :: PREC
196 INTEGER :: SIZ
197
198 root = 65521
199 two_power_16 = 65536
200 s1 = 1
201 s2 = 0
202 prec = 2
203
204 IF(sizeof(a(1,1)) == 4) prec = 1
205 siz = siz1*siz2 * prec
206 ALLOCATE(tmp(siz))
207 tmp(1:siz) = 0
208
209 tmp = transfer(a(1:siz2,1:siz1),s1,siz)
210 DO i = 1,siz
211 s1 = mod(s1 + tmp(i),root)
212 s2 = mod(s1 + s2 ,root)
213 ENDDO
214
215 checksum = ior(s2 * two_power_16,s1)
216 DEALLOCATE(tmp)