11
11
from ..context import skip_if_no_bayesopt_botorch , skip_if_no_bayesopt_gpytorch , skip_if_no_pyatf
12
12
13
13
14
+ cache_filename = Path (__file__ ).parent / "test_cache_file.json"
15
+
14
16
@pytest .fixture
15
17
def vector_add ():
16
18
kernel_string = """
@@ -53,7 +55,6 @@ def vector_add():
53
55
strategies .append (s )
54
56
@pytest .mark .parametrize ('strategy' , strategies )
55
57
def test_strategies (vector_add , strategy ):
56
- cache_filename = Path (__file__ ).parent / "test_cache_file.json"
57
58
options = dict (popsize = 5 , neighbor = 'adjacent' )
58
59
59
60
print (f"testing { strategy } " )
@@ -69,18 +70,19 @@ def test_strategies(vector_add, strategy):
69
70
restrictions = ["test_string == 'alg_2'" , "test_bool == True" , "test_mixed == 2.45" ]
70
71
71
72
# pyATF can't handle non-number tune parameters, so we filter them out
73
+ cache_filename_local = cache_filename
72
74
if strategy == "pyatf_strategies" :
73
75
tune_params = {
74
76
"block_size_x" : [128 + 64 * i for i in range (15 )]
75
77
}
76
78
restrictions = []
77
- cache_filename = cache_filename .parent .parent / "test_cache_file.json"
79
+ cache_filename_local = cache_filename_local .parent .parent / "test_cache_file.json"
78
80
vector_add [- 1 ] = tune_params
79
81
80
82
# run the tuning in simulation mode
81
- assert cache_filename .exists ()
83
+ assert cache_filename_local .exists ()
82
84
results , _ = kernel_tuner .tune_kernel (* vector_add , restrictions = restrictions , strategy = strategy , strategy_options = filter_options ,
83
- verbose = False , cache = cache_filename , simulation_mode = True )
85
+ verbose = False , cache = cache_filename_local , simulation_mode = True )
84
86
85
87
assert len (results ) > 0
86
88
0 commit comments