Merge branch 'master' into reconnection

This commit is contained in:
Grzegorz Kowal 2020-05-13 14:58:18 -03:00
commit 5696b87e37
3 changed files with 52 additions and 48 deletions

View File

@ -193,9 +193,6 @@ class AmunXML:
rm = np.array([nx, ny]) rm = np.array([nx, ny])
bm = np.array([nc, nc]) bm = np.array([nc, nc])
dm = rm[0:nd] * int(nc * 2**(ml - 1) / self.shrink)
arr = np.zeros(dm[:])
dfile = op.join(self.path, 'metablock_fields.bin') dfile = op.join(self.path, 'metablock_fields.bin')
if op.exists(dfile): if op.exists(dfile):
mset = np.fromfile(dfile, dtype='int32') mset = np.fromfile(dfile, dtype='int32')
@ -215,6 +212,10 @@ class AmunXML:
for n in range(nm): for n in range(nm):
level[mset[0,n]] = mset[ 1,n] level[mset[0,n]] = mset[ 1,n]
coord[mset[0,n]] = mset[2:5,n] coord[mset[0,n]] = mset[2:5,n]
ml = mset[1,:].max()
dm = rm[0:nd] * int(nc * 2**(ml - 1) / self.shrink)
arr = np.zeros(dm[:])
for n in range(self.attributes['nprocs']): for n in range(self.attributes['nprocs']):

View File

@ -77,23 +77,23 @@ module hash
! !
! Arguments: ! Arguments:
! !
! n - the size of the input vector; ! n - the size of the input vector;
! data - the input vactor of integer values; ! input - the input vactor of integer values;
! !
!=============================================================================== !===============================================================================
! !
integer(kind=8) function xxh64_integer(n, data) result(hash) integer(kind=8) function xxh64_integer(n, input) result(hash)
implicit none implicit none
! subroutine arguments ! subroutine arguments
! !
integer(kind=4) , intent(in) :: n integer(kind=4) , intent(in) :: n
integer(kind=4), dimension(n), intent(in) :: data integer(kind=4), dimension(n), intent(in) :: input
! local variables ! local variables
! !
integer(kind=8) :: remain, offset integer(kind=4) :: remain, offset
! local arrays ! local arrays
! !
@ -112,7 +112,7 @@ module hash
lane(4) = seed - prime1 lane(4) = seed - prime1
do while (remain >= 8) do while (remain >= 8)
chk(1:4) = transfer(data(offset:offset+7), chk) chk(1:4) = transfer(input(offset:offset+7), chk)
lane(1) = xxh64_round(lane(1), chk(1)) lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2)) lane(2) = xxh64_round(lane(2), chk(2))
@ -135,10 +135,10 @@ module hash
hash = seed + prime5 hash = seed + prime5
end if end if
hash = hash + int(4 * n, kind = 8) hash = hash + 4_8 * n
do while (remain >= 2) do while (remain >= 2)
chk(1) = transfer(data(offset:offset+1), chk(1)) chk(1) = transfer(input(offset:offset+1), chk(1))
hash = ieor(hash, xxh64_round(0_8, chk(1))) hash = ieor(hash, xxh64_round(0_8, chk(1)))
hash = xxh64_rotl(hash, 27) hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4 hash = hash * prime1 + prime4
@ -148,7 +148,8 @@ module hash
end do end do
if (remain == 1) then if (remain == 1) then
hash = ieor(hash, data(offset) * prime1) chk(1) = transfer((/ input(offset), 0 /), chk(1))
hash = ieor(hash, chk(1) * prime1)
hash = xxh64_rotl(hash, 23) hash = xxh64_rotl(hash, 23)
hash = hash * prime2 + prime3 hash = hash * prime2 + prime3
@ -173,23 +174,23 @@ module hash
! !
! Arguments: ! Arguments:
! !
! n - the size of the input vector; ! n - the size of the input vector;
! data - the input vactor of real values; ! input - the input vactor of real values;
! !
!=============================================================================== !===============================================================================
! !
integer(kind=8) function xxh64_long(n, data) result(hash) integer(kind=8) function xxh64_long(n, input) result(hash)
implicit none implicit none
! subroutine arguments ! subroutine arguments
! !
integer(kind=4) , intent(in) :: n integer(kind=4) , intent(in) :: n
integer(kind=8), dimension(n), intent(in) :: data integer(kind=8), dimension(n), intent(in) :: input
! local variables ! local variables
! !
integer(kind=8) :: remain, offset integer(kind=4) :: remain, offset
! local arrays ! local arrays
! !
@ -208,7 +209,7 @@ module hash
lane(4) = seed - prime1 lane(4) = seed - prime1
do while (remain >= 4) do while (remain >= 4)
chk(1:4) = transfer(data(offset:offset+3), chk) chk(1:4) = transfer(input(offset:offset+3), chk)
lane(1) = xxh64_round(lane(1), chk(1)) lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2)) lane(2) = xxh64_round(lane(2), chk(2))
@ -231,10 +232,10 @@ module hash
hash = seed + prime5 hash = seed + prime5
end if end if
hash = hash + int(8 * n, kind = 8) hash = hash + 8_8 * n
do while (remain >= 1) do while (remain >= 1)
hash = ieor(hash, xxh64_round(0_8, transfer(data(offset), 0_8))) hash = ieor(hash, xxh64_round(0_8, transfer(input(offset), 0_8)))
hash = xxh64_rotl(hash, 27) hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4 hash = hash * prime1 + prime4
@ -259,23 +260,23 @@ module hash
! !
! Arguments: ! Arguments:
! !
! n - the size of the input vector; ! n - the size of the input vector;
! data - the input vactor of real values; ! input - the input vactor of real values;
! !
!=============================================================================== !===============================================================================
! !
integer(kind=8) function xxh64_double(n, data) result(hash) integer(kind=8) function xxh64_double(n, input) result(hash)
implicit none implicit none
! subroutine arguments ! subroutine arguments
! !
integer(kind=4) , intent(in) :: n integer(kind=4) , intent(in) :: n
real(kind=8), dimension(n), intent(in) :: data real(kind=8), dimension(n), intent(in) :: input
! local variables ! local variables
! !
integer(kind=8) :: remain, offset integer(kind=4) :: remain, offset
! local arrays ! local arrays
! !
@ -294,7 +295,7 @@ module hash
lane(4) = seed - prime1 lane(4) = seed - prime1
do while (remain >= 4) do while (remain >= 4)
chk(1:4) = transfer(data(offset:offset+3), chk) chk(1:4) = transfer(input(offset:offset+3), chk)
lane(1) = xxh64_round(lane(1), chk(1)) lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2)) lane(2) = xxh64_round(lane(2), chk(2))
@ -317,10 +318,10 @@ module hash
hash = seed + prime5 hash = seed + prime5
end if end if
hash = hash + int(8 * n, kind = 8) hash = hash + 8_8 * n
do while (remain >= 1) do while (remain >= 1)
hash = ieor(hash, xxh64_round(0_8, transfer(data(offset), 0_8))) hash = ieor(hash, xxh64_round(0_8, transfer(input(offset), 0_8)))
hash = xxh64_rotl(hash, 27) hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4 hash = hash * prime1 + prime4
@ -345,23 +346,23 @@ module hash
! !
! Arguments: ! Arguments:
! !
! n - the size of the input vector; ! n - the size of the input vector;
! data - the input vactor of real values; ! input - the input vactor of real values;
! !
!=============================================================================== !===============================================================================
! !
integer(kind=8) function xxh64_complex(n, data) result(hash) integer(kind=8) function xxh64_complex(n, input) result(hash)
implicit none implicit none
! subroutine arguments ! subroutine arguments
! !
integer(kind=4) , intent(in) :: n integer(kind=4) , intent(in) :: n
complex(kind=8), dimension(n), intent(in) :: data complex(kind=8), dimension(n), intent(in) :: input
! local variables ! local variables
! !
integer(kind=8) :: remain, offset integer(kind=4) :: remain, offset
! local arrays ! local arrays
! !
@ -380,7 +381,7 @@ module hash
lane(4) = seed - prime1 lane(4) = seed - prime1
do while (remain >= 2) do while (remain >= 2)
chk(1:4) = transfer(data(offset:offset+1), chk) chk(1:4) = transfer(input(offset:offset+1), chk)
lane(1) = xxh64_round(lane(1), chk(1)) lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2)) lane(2) = xxh64_round(lane(2), chk(2))
@ -403,13 +404,13 @@ module hash
hash = seed + prime5 hash = seed + prime5
end if end if
hash = hash + int(16 * n, kind = 8) hash = hash + 16_8 * n
if (remain == 1) then if (remain == 1) then
hash = ieor(hash, xxh64_round(0_8, transfer(dreal(data(offset)), 0_8))) hash = ieor(hash, xxh64_round(0_8, transfer(dreal(input(offset)), 0_8)))
hash = xxh64_rotl(hash, 27) hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4 hash = hash * prime1 + prime4
hash = ieor(hash, xxh64_round(0_8, transfer(dimag(data(offset)), 0_8))) hash = ieor(hash, xxh64_round(0_8, transfer(dimag(input(offset)), 0_8)))
hash = xxh64_rotl(hash, 27) hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4 hash = hash * prime1 + prime4

View File

@ -1572,16 +1572,18 @@ module io
! check the number of forcing modes ! check the number of forcing modes
! !
if (lnmodes == nmodes .and. lnmodes > 0) then if (lnmodes == nmodes) then
write(fname,"(a,'forcing_coefficients.bin')") trim(dname) if (lnmodes > 0) then
open(newunit = lun, file = fname, form = 'unformatted', & write(fname,"(a,'forcing_coefficients.bin')") trim(dname)
access = 'direct', recl = sizeof(fcoefs)) open(newunit = lun, file = fname, form = 'unformatted', &
read(lun, rec = 1) fcoefs access = 'direct', recl = sizeof(fcoefs))
close(lun) read(lun, rec = 1) fcoefs
read(hforce(7:), fmt = "(1z16)") hash close(lun)
if (hash /= xxh64_complex(size(fcoefs), fcoefs)) then read(hforce(7:), fmt = "(1z16)") hash
write(error_unit,"('[',a,']: ',a)") trim(loc) & if (hash /= xxh64_complex(size(fcoefs), fcoefs)) then
, "'" // trim(fname) // "' seems to be corrupted!" write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "'" // trim(fname) // "' seems to be corrupted!"
end if
end if end if
else else
write(error_unit,"('[',a,']: ',a)") trim(loc) & write(error_unit,"('[',a,']: ',a)") trim(loc) &
@ -2025,7 +2027,7 @@ module io
! prepare and store metablocks ! prepare and store metablocks
! !
allocate(fields(nm,14), children(nm,nc), bounds(nm,3,2), & allocate(fields(nm,14), children(nm,nc), bounds(nm,NDIMS,2), &
#if NDIMS == 3 #if NDIMS == 3
faces(nm,NDIMS,ns,ns,ns), & faces(nm,NDIMS,ns,ns,ns), &
edges(nm,NDIMS,ns,ns,ns), corners(nm,ns,ns,ns), & edges(nm,NDIMS,ns,ns,ns), corners(nm,ns,ns,ns), &