Skip to content

Commit 2d37106

Browse files
committed
add cmake control on cases which give considerable different results when float or double is used
1 parent a004a36 commit 2d37106

File tree

9 files changed

+135
-3
lines changed

9 files changed

+135
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<dtw_distance>
3-
<DTWDistance Position_0="2.9230477374049921" />
3+
<DTWDistance Position_0="4.0" />
44
</dtw_distance>

tests/tests_sycl/2d_examples/test_2d_diffusion_NeumannBC_sycl/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ SET(BUILD_RELOAD_PATH "${EXECUTABLE_OUTPUT_PATH}/reload")
88

99
file(MAKE_DIRECTORY ${BUILD_INPUT_PATH})
1010
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_INPUT_PATH})
11-
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_INPUT_PATH})
11+
if(SPHINXSYS_USE_SYCL) # this case gives more significant differences when use sycl as float other double is used
12+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool_sycl/ DESTINATION ${BUILD_INPUT_PATH})
13+
else()
14+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool_ck/ DESTINATION ${BUILD_INPUT_PATH})
15+
endif()
16+
17+
1218

1319
add_executable(${PROJECT_NAME})
1420
aux_source_directory(. DIR_SRCS)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<meanvariance>
3+
<Mean_Element>
4+
<Snapshot_0 Phi_0="99.999999999999943" Phi_1="99.999999999999957" Phi_2="99.999999999999957" Phi_3="99.999999999999957" Phi_4="99.999999999999829" />
5+
<Snapshot_3030 Phi_0="196.40255305146761" Phi_1="129.74703294168015" Phi_2="137.19408710097244" Phi_3="184.63109804369483" Phi_4="253.43862143093793" />
6+
<Snapshot_6060 Phi_0="230.62960048883869" Phi_1="165.78769925562548" Phi_2="175.47974371661178" Phi_3="217.1307703498409" Phi_4="271.05796640239629" />
7+
<Snapshot_9090 Phi_0="265.98027554458531" Phi_1="200.27157834224036" Phi_2="206.47161540518084" Phi_3="239.73197538383957" Phi_4="282.48664893350775" />
8+
<Snapshot_12120 Phi_0="297.90360972950953" Phi_1="230.80680459288394" Phi_2="232.65908049711513" Phi_3="257.93918498850553" Phi_4="291.47855989637497" />
9+
<Snapshot_15150 Phi_0="325.72319515908339" Phi_1="257.27836860328802" Phi_2="255.06974261025991" Phi_3="273.30468637847144" Phi_4="299.01259949400514" />
10+
<Snapshot_18180 Phi_0="349.73587591881341" Phi_1="280.0949057408755" Phi_2="274.31701483932824" Phi_3="286.44951374217914" Phi_4="305.44455846312388" />
11+
<Snapshot_21210 Phi_0="370.4082559647145" Phi_1="299.72978508065955" Phi_2="290.8639035698568" Phi_3="297.73776416571559" Phi_4="310.96489205986813" />
12+
<Snapshot_24240 Phi_0="388.19207099080495" Phi_1="316.61922340484108" Phi_2="305.09320789567994" Phi_3="307.44201268589273" Phi_4="315.70983693295398" />
13+
<Snapshot_27270 Phi_0="403.48786272055622" Phi_1="331.14532465898833" Phi_2="317.33047207974147" Phi_3="315.78700484668406" Phi_4="319.78998497847647" />
14+
<Snapshot_30300 Phi_0="416.64298056414356" Phi_1="343.63836652402529" Phi_2="327.85479719967543" Phi_3="322.96371961471891" Phi_4="323.29887960779973" />
15+
</Mean_Element>
16+
<Variance_Element>
17+
<Snapshot_0 Phi_0="0.99999999999999889" Phi_1="0.99999999999999911" Phi_2="0.99999999999999911" Phi_3="0.99999999999999911" Phi_4="0.99999999999999667" />
18+
<Snapshot_3030 Phi_0="3.857396284513456" Phi_1="1.6834292557169439" Phi_2="1.8822217535469214" Phi_3="3.4088642364820458" Phi_4="6.4231134832814263" />
19+
<Snapshot_6060 Phi_0="5.3190012621641358" Phi_1="2.7485561224473725" Phi_2="3.0793140454847756" Phi_3="4.7145771432715344" Phi_4="7.3472421150202623" />
20+
<Snapshot_9090 Phi_0="7.0745506978773518" Phi_1="4.0108705091692123" Phi_2="4.2630527968024907" Phi_3="5.7471420021437858" Phi_4="7.9798706825682899" />
21+
<Snapshot_12120 Phi_0="8.8746560689871927" Phi_1="5.3271781046377713" Phi_2="5.4130247737763106" Phi_3="6.653262315253448" Phi_4="8.4959750879264693" />
22+
<Snapshot_15150 Phi_0="10.609559986464234" Phi_1="6.6192158951169331" Phi_2="6.5060573595264231" Phi_3="7.469545159643463" Phi_4="8.9408534656162342" />
23+
<Snapshot_18180 Phi_0="12.231518290469969" Phi_1="7.8453156221989966" Phi_2="7.5249824630360216" Phi_3="8.205332392313089" Phi_4="9.3296378294732705" />
24+
<Snapshot_21210 Phi_0="13.720227608682146" Phi_1="8.9837944064498423" Phi_2="8.4601810399894966" Phi_3="8.8647776210399289" Phi_4="9.6699164093805443" />
25+
<Snapshot_24240 Phi_0="15.069308398013034" Phi_1="10.02477326294847" Phi_2="9.3081865504076635" Phi_3="9.4520591164352687" Phi_4="9.9672701136232611" />
26+
<Snapshot_27270 Phi_0="16.280245536280241" Phi_1="10.965722604350679" Phi_2="10.069862851035158" Phi_3="9.9721432430039663" Phi_4="10.226563449253421" />
27+
<Snapshot_30300 Phi_0="17.359137325337329" Phi_1="11.808732694730034" Phi_2="10.748876804684031" Phi_3="10.430556418737476" Phi_4="10.45221655556586" />
28+
</Variance_Element>
29+
</meanvariance>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
true
2+
6
3+
5
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# !/usr/bin/env python3
2+
import os
3+
import sys
4+
5+
def find_upper_folder(folder_name, start_path=None):
6+
"""
7+
Search for an upper-level folder by name, starting from a given directory and traversing upwards.
8+
"""
9+
if start_path is None:
10+
start_path = os.getcwd()
11+
12+
current_path = start_path
13+
while True:
14+
potential_path = os.path.join(current_path, folder_name)
15+
if os.path.isdir(potential_path):
16+
return potential_path
17+
parent_path = os.path.dirname(current_path)
18+
if parent_path == current_path: # Reached the root directory
19+
break
20+
current_path = parent_path
21+
22+
return None
23+
24+
def find_nested_folder(folder_chain, start_path=None):
25+
"""
26+
Find a nested folder by traversing upward and then descending into a specified folder chain.
27+
"""
28+
if not folder_chain:
29+
return None
30+
31+
# Step 1: Find the first folder in the chain
32+
first_folder = folder_chain[0]
33+
first_folder_path = find_upper_folder(first_folder, start_path)
34+
if not first_folder_path:
35+
return None
36+
37+
# Step 2: Traverse the rest of the folder chain
38+
current_path = first_folder_path
39+
for folder in folder_chain[1:]:
40+
current_path = os.path.join(current_path, folder)
41+
if not os.path.isdir(current_path):
42+
return None
43+
44+
return current_path
45+
46+
# Step 1: Find the RegressionTest folder
47+
folder_chain = ["build", "PythonScriptStore", "RegressionTest"]
48+
regression_test_folder = find_nested_folder(folder_chain)
49+
50+
if not regression_test_folder:
51+
print("'RegressionTest' folder not found.")
52+
exit(1)
53+
54+
# Step 2: Add the RegressionTest folder to sys.path
55+
if regression_test_folder not in sys.path:
56+
sys.path.insert(0, regression_test_folder)
57+
58+
# Step 3: Import the module
59+
try:
60+
from regression_test_base_tool import SphinxsysRegressionTest
61+
print("Module imported successfully!")
62+
except ImportError as e:
63+
print(f"Failed to import module: {e}")
64+
65+
66+
"""
67+
case name: test_2d_diffusion_NeumannBC
68+
"""
69+
70+
case_name = "test_2d_diffusion_NeumannBC_ck"
71+
body_name = "TemperatureObserver"
72+
parameter_name = "Phi"
73+
74+
number_of_run_times = 0
75+
converged = 0
76+
sphinxsys = SphinxsysRegressionTest(case_name, body_name, parameter_name)
77+
78+
79+
while True:
80+
print("Now start a new run......")
81+
sphinxsys.run_case()
82+
number_of_run_times += 1
83+
converged = sphinxsys.read_dat_file()
84+
print("Please note: This is the", number_of_run_times, "run!")
85+
if number_of_run_times <= 200:
86+
if (converged == "true"):
87+
print("The tested parameters of all variables are converged, and the run will stop here!")
88+
break
89+
elif converged != "true":
90+
print("The tested parameters of", sphinxsys.sphinxsys_parameter_name, "are not converged!")
91+
continue
92+
else:
93+
print("It's too many runs but still not converged, please try again!")
94+
break
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<dtw_distance>
3-
<DTWDistance TotalMechanicalEnergy_0="0.002" />
3+
<DTWDistance TotalMechanicalEnergy_0="0.003" />
44
</dtw_distance>

0 commit comments

Comments
 (0)