12
12
MaxProdConstraint ,
13
13
MinConflictsSolver ,
14
14
OptimizedBacktrackingSolver ,
15
- ParallelSolver ,
15
+ # ParallelSolver,
16
16
Problem ,
17
17
RecursiveBacktrackingSolver ,
18
18
Solver ,
19
19
)
20
20
21
21
from kernel_tuner .util import check_restrictions as check_instance_restrictions
22
- from kernel_tuner .util import compile_restrictions , default_block_size_names , get_interval
22
+ from kernel_tuner .util import (
23
+ compile_restrictions ,
24
+ default_block_size_names ,
25
+ get_interval ,
26
+ )
23
27
24
28
supported_neighbor_methods = ["strictly-adjacent" , "adjacent" , "Hamming" ]
25
29
@@ -69,7 +73,9 @@ def __init__(
69
73
if (
70
74
len (restrictions ) > 0
71
75
and any (isinstance (restriction , str ) for restriction in restrictions )
72
- and not (framework_l == "pysmt" or framework_l == "bruteforce" or solver_method .lower () == "pc_parallelsolver" )
76
+ and not (
77
+ framework_l == "pysmt" or framework_l == "bruteforce" or solver_method .lower () == "pc_parallelsolver"
78
+ )
73
79
):
74
80
self .restrictions = compile_restrictions (
75
81
restrictions ,
@@ -101,7 +107,8 @@ def __init__(
101
107
elif solver_method .lower () == "pc_optimizedbacktrackingsolver" :
102
108
solver = OptimizedBacktrackingSolver (forwardcheck = False )
103
109
elif solver_method .lower () == "pc_parallelsolver" :
104
- solver = ParallelSolver ()
110
+ raise NotImplementedError ("ParallelSolver is not yet implemented" )
111
+ # solver = ParallelSolver()
105
112
elif solver_method .lower () == "pc_recursivebacktrackingsolver" :
106
113
solver = RecursiveBacktrackingSolver ()
107
114
elif solver_method .lower () == "pc_minconflictssolver" :
@@ -266,7 +273,7 @@ def all_smt(formula, keys) -> list:
266
273
267
274
def __build_searchspace_pyATF (self , block_size_names : list , max_threads : int , solver : Solver ):
268
275
"""Builds the searchspace using pyATF."""
269
- from pyatf import TP , Set , Interval , Tuner
276
+ from pyatf import TP , Interval , Set , Tuner
270
277
from pyatf .cost_functions .generic import CostFunction
271
278
from pyatf .search_techniques import Exhaustive
272
279
@@ -282,7 +289,9 @@ def __build_searchspace_pyATF(self, block_size_names: list, max_threads: int, so
282
289
# adding the default blocksize restriction requires recompilation because pyATF requires combined restrictions for the same parameter
283
290
max_block_size_product = f"{ ' * ' .join (valid_block_size_names )} <= { max_threads } "
284
291
restrictions = self ._modified_restrictions .copy () + [max_block_size_product ]
285
- self .restrictions = compile_restrictions (restrictions , self .tune_params , format = "pyatf" , try_to_constraint = False )
292
+ self .restrictions = compile_restrictions (
293
+ restrictions , self .tune_params , format = "pyatf" , try_to_constraint = False
294
+ )
286
295
287
296
# build a dictionary of the restrictions, combined based on last parameter
288
297
res_dict = dict ()
@@ -295,7 +304,9 @@ def __build_searchspace_pyATF(self, block_size_names: list, max_threads: int, so
295
304
continue
296
305
if all (p in registered_params for p in params ):
297
306
if param in res_dict :
298
- raise KeyError (f"`{ param } ` is already in res_dict with `{ res_dict [param ][1 ]} `, can't add `{ source } `" )
307
+ raise KeyError (
308
+ f"`{ param } ` is already in res_dict with `{ res_dict [param ][1 ]} `, can't add `{ source } `"
309
+ )
299
310
res_dict [param ] = (res , source )
300
311
print (source , res , param , params )
301
312
registered_restrictions .append (index )
@@ -305,7 +316,9 @@ def get_params():
305
316
params = list ()
306
317
for index , (key , values ) in enumerate (self .tune_params .items ()):
307
318
vi = get_interval (values )
308
- vals = Interval (vi [0 ], vi [1 ], vi [2 ]) if vi is not None and vi [2 ] != 0 else Set (* np .array (values ).flatten ())
319
+ vals = (
320
+ Interval (vi [0 ], vi [1 ], vi [2 ]) if vi is not None and vi [2 ] != 0 else Set (* np .array (values ).flatten ())
321
+ )
309
322
constraint = res_dict .get (key , None )
310
323
constraint_source = None
311
324
if constraint is not None :
0 commit comments