@@ -35,37 +35,18 @@ class HypertunerFunctions(Backend):
35
35
"""Class for executing hyperparameter tuning."""
36
36
units = {}
37
37
38
- def __init__ (self , iterations ):
38
+ def __init__ (self , iterations , compiler_options = None ):
39
39
self .iterations = iterations
40
+ self .compiler_options = compiler_options
40
41
self .observers = [ScoreObserver (self )]
41
42
self .name = platform .processor ()
42
43
self .max_threads = 1024
43
44
self .last_score = None
44
45
45
- # set the environment options
46
- env = dict ()
47
- env ["iterations" ] = self .iterations
48
- self .env = env
49
-
50
- # check for the methodology package
51
- if methodology_available is not True :
52
- raise ImportError ("Unable to import the autotuning methodology, run `pip install autotuning_methodology`." )
53
-
54
- def ready_argument_list (self , arguments ):
55
- arglist = super ().ready_argument_list (arguments )
56
- if arglist is None :
57
- arglist = []
58
- return arglist
59
-
60
- def compile (self , kernel_instance ):
61
- super ().compile (kernel_instance )
62
- path = Path (__file__ ).parent .parent .parent / "hyperparamtuning"
63
- path .mkdir (exist_ok = True )
64
-
65
- # TODO get applications & GPUs args from benchmark
66
- gpus = ["A100" , "A4000" , "MI250X" ]
46
+ # set the defaults
47
+ self .gpus = ["A100" , "A4000" , "MI250X" ]
67
48
folder = "../autotuning_methodology/benchmark_hub/kernels"
68
- applications = [
49
+ self . applications = [
69
50
{
70
51
"name" : "dedispersion_milo" ,
71
52
"folder" : folder ,
@@ -91,6 +72,51 @@ def compile(self, kernel_instance):
91
72
"objective_performance_keys" : ["time" ]
92
73
}
93
74
]
75
+ # any additional settings
76
+ self .override = {
77
+ "experimental_groups_defaults" : {
78
+ "repeats" : 25 ,
79
+ "samples" : self .iterations ,
80
+ "minimum_fraction_of_budget_valid" : 0.01 ,
81
+ },
82
+ "statistics_settings" : {
83
+ "cutoff_percentile" : 0.95 ,
84
+ "cutoff_percentile_start" : 0.01 ,
85
+ "cutoff_type" : "time" ,
86
+ "objective_time_keys" : [
87
+ "all"
88
+ ]
89
+ }
90
+ }
91
+
92
+ # override the defaults with compiler options if provided
93
+ if self .compiler_options is not None :
94
+ if "gpus" in self .compiler_options :
95
+ self .gpus = self .compiler_options ["gpus" ]
96
+ if "applications" in self .compiler_options :
97
+ self .applications = self .compiler_options ["applications" ]
98
+ if "override" in self .compiler_options :
99
+ self .override = self .compiler_options ["override" ]
100
+
101
+ # set the environment options
102
+ env = dict ()
103
+ env ["iterations" ] = self .iterations
104
+ self .env = env
105
+
106
+ # check for the methodology package
107
+ if methodology_available is not True :
108
+ raise ImportError ("Unable to import the autotuning methodology, run `pip install autotuning_methodology`." )
109
+
110
+ def ready_argument_list (self , arguments ):
111
+ arglist = super ().ready_argument_list (arguments )
112
+ if arglist is None :
113
+ arglist = []
114
+ return arglist
115
+
116
+ def compile (self , kernel_instance ):
117
+ super ().compile (kernel_instance )
118
+ path = Path (__file__ ).parent .parent .parent / "hyperparamtuning"
119
+ path .mkdir (exist_ok = True )
94
120
95
121
# strategy settings
96
122
strategy : str = kernel_instance .arguments [0 ]
@@ -104,18 +130,9 @@ def compile(self, kernel_instance):
104
130
'search_method_hyperparameters' : hyperparams
105
131
}]
106
132
107
- # any additional settings
108
- override = {
109
- "experimental_groups_defaults" : {
110
- "repeats" : 25 ,
111
- "samples" : self .iterations ,
112
- "minimum_fraction_of_budget_valid" : 0.01 ,
113
- }
114
- }
115
-
116
133
name = kernel_instance .name if len (kernel_instance .name ) > 0 else kernel_instance .kernel_source .kernel_name
117
- experiments_filepath = generate_experiment_file (name , path , searchspace_strategies , applications , gpus ,
118
- override = override , generate_unique_file = True , overwrite_existing_file = True )
134
+ experiments_filepath = generate_experiment_file (name , path , searchspace_strategies , self . applications , self . gpus ,
135
+ override = self . override , generate_unique_file = True , overwrite_existing_file = True )
119
136
return str (experiments_filepath )
120
137
121
138
def start_event (self ):
0 commit comments