Skip to content

Commit a5ebe3e

Browse files
author
Archith Iyer
committed
handle cases with NaNs after finding source of error
1 parent b4505c9 commit a5ebe3e

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

toolchain/mfc/test/case.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def __str__(self) -> str:
213213
return f"tests/[bold magenta]{self.get_uuid()}[/bold magenta]: {self.trace}"
214214

215215
def compute_tolerance(self) -> float:
216+
if ARG("single"):
217+
return 1e-1
216218
if self.params.get("hypoelasticity", 'F') == 'T':
217219
return 1e-7
218220
if any(self.params.get(key, 'F') == 'T' for key in ['relax', 'ib', 'qbmm', 'bubbles']):

toolchain/mfc/test/test.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ def test():
132132

133133
# pylint: disable=too-many-locals, too-many-branches, too-many-statements, trailing-whitespace
134134
def _handle_case(case: TestCase, devices: typing.Set[int]):
135+
# pylint: disable=global-statement, global-variable-not-assigned
136+
global nSKIP
137+
135138
start_time = time.time()
136139

137-
tol = case.compute_tolerance()
138-
139-
if ARG("single"):
140-
tol *= 1e10
140+
tol = case.compute_tolerance()
141141

142142
case.delete_output()
143143
case.create_directory()
@@ -202,7 +202,11 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
202202
raise MFCException(f"Test {case}: Failed to run h5dump. You can find the run's output in {out_filepath}, and the case dictionary in {case.get_filepath()}.")
203203

204204
if "nan," in output:
205-
raise MFCException(f"Test {case}: Post Process has detected a NaN. You can find the run's output in {out_filepath}, and the case dictionary in {case.get_filepath()}.")
205+
if not ARG("single"):
206+
raise MFCException(f"Test {case}: Post Process has detected a NaN. You can find the run's output in {out_filepath}, and the case dictionary in {case.get_filepath()}.")
207+
cons.print(f"Test {case}: Skipping this test case as it cannot be run in single precision, please build MFC in double precision to run this test")
208+
nSKIP += 1
209+
return
206210

207211
if "inf," in output:
208212
raise MFCException(f"Test {case}: Post Process has detected an Infinity. You can find the run's output in {out_filepath}, and the case dictionary in {case.get_filepath()}.")

0 commit comments

Comments
 (0)