File tree Expand file tree Collapse file tree
tools/AutoTuner/src/autotuner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -569,13 +569,24 @@ def sweep():
569569 queue = Queue ()
570570 parameter_list = list ()
571571 for name , content in config_dict .items ():
572- if not isinstance (content , list ):
572+ if isinstance (content , dict ) and content .get ("type" ) == "string" :
573+ if "values" not in content :
574+ print (
575+ f"[ERROR TUN-0016] { name } string parameter missing 'values' field."
576+ )
577+ sys .exit (1 )
578+ if not isinstance (content ["values" ], list ) or len (content ["values" ]) == 0 :
579+ print (f"[ERROR TUN-0017] { name } 'values' must be a non-empty list." )
580+ sys .exit (1 )
581+ parameter_list .append ([{name : i } for i in content ["values" ]])
582+ elif isinstance (content , list ):
583+ if content [- 1 ] == 0 :
584+ print ("[ERROR TUN-0014] Sweep does not support step value zero." )
585+ sys .exit (1 )
586+ parameter_list .append ([{name : i } for i in np .arange (* content )])
587+ else :
573588 print (f"[ERROR TUN-0015] { name } sweep is not supported." )
574589 sys .exit (1 )
575- if content [- 1 ] == 0 :
576- print ("[ERROR TUN-0014] Sweep does not support step value zero." )
577- sys .exit (1 )
578- parameter_list .append ([{name : i } for i in np .arange (* content )])
579590 parameter_list = list (product (* parameter_list ))
580591 for parameter in parameter_list :
581592 temp = dict ()
Original file line number Diff line number Diff line change @@ -442,6 +442,8 @@ def read(path):
442442 return ret
443443
444444 def read_sweep (this ):
445+ if this .get ("type" ) == "string" :
446+ return {"type" : "string" , "values" : this ["values" ]}
445447 return [* this ["minmax" ], this ["step" ]]
446448
447449 def apply_condition (config , data ):
You can’t perform that action at this time.
0 commit comments