-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't require bit reproducable for bump on tail and landau restart tests
Set an absolute and relative tolerance of 1e-14 on parallel tests (OpenMP and Cuda). The tolerance is set to 0.0 for serial tests. This is a stop-gap solution until a physically relevant tolerance can be found. See merge request gysela-developpers/gyselalibxx!454 -------------------------------------------- Co-authored-by: Emily Bourne <[email protected]>
- Loading branch information
1 parent
c9095c0
commit e2a284b
Showing
8 changed files
with
92 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# SPDX-License-Identifier: MIT | ||
""" Compare HDF5 results between two files. | ||
""" | ||
from argparse import ArgumentParser | ||
import h5py as h5 | ||
|
||
import numpy as np | ||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser( | ||
description='Compare HDF5 results between two files') | ||
parser.add_argument('file1', | ||
type=h5.File, | ||
help='File name of the first HDF5 file') | ||
parser.add_argument('file2', | ||
type=h5.File, | ||
help='File name of the second HDF5 file') | ||
parser.add_argument('obj', | ||
type=str, | ||
help='Name of an HDF5 object, in absolute path') | ||
parser.add_argument('-R', '--relative', | ||
nargs='?', | ||
type=float, | ||
metavar='TOL', | ||
help='The tolerance for the relative difference') | ||
parser.add_argument('-A', '--absolute', | ||
nargs='?', | ||
type=float, | ||
metavar='TOL', | ||
help='The tolerance for the absolute difference') | ||
|
||
args = parser.parse_args() | ||
|
||
vals1 = np.array(args.file1[args.obj]) | ||
vals2 = np.array(args.file2[args.obj]) | ||
|
||
abs_error = np.abs(vals1 - vals2) | ||
rel_error = abs_error / np.abs(vals2) | ||
|
||
print("Maximum absolute error found : ", abs_error.max()) | ||
print("Maximum relative error found : ", rel_error.max()) | ||
|
||
args.file1.close() | ||
args.file2.close() | ||
|
||
if args.relative: | ||
assert args.absolute | ||
assert np.allclose(vals1, vals2, rtol=args.relative, atol=args.absolute) | ||
else: | ||
assert np.array_equal(vals1, vals2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters