cs.add_hyperparameters([p0, p1, p2, p3, p4, p5]) #cond1 = CS.InCondition(p1, p0, ['#pragma clang loop(j2) pack array(A) allocate(malloc)']) #cs.add_condition(cond1) # problem space task_space = None input_space = cs output_space = Space([Real(0.0, inf, name="time")]) dir_path = os.path.dirname(os.path.realpath(__file__)) kernel_idx = dir_path.rfind('/') kernel = dir_path[kernel_idx + 1:] obj = Plopper(dir_path + '/mmp.c', dir_path) x1 = ['p0', 'p1', 'p2', 'p3', 'p4', 'p5'] def myobj(point: dict): def plopper_func(x): x = np.asarray_chkfinite(x) # ValueError if any NaN or Inf values = [point[k] for k in x1] print('VALUES:', values) params = ["P0", "P1", "P2", "P3", "P4", "P5"] result = obj.findRuntime(values, params) print("RESULT: ", result) return result
x = [p0, p1, p2] p0_dict = {'a': "static", 'b': "dynamic"} p1_dict = {'a': "1", 'b': "8", 'c': "16"} p2_dict = { 'a': "1", 'b': "2", 'c': "4", 'd': "8", 'e': "14", 'f': "16", 'g': "20", 'h': "28" } obj = Plopper() def plopper_func(x): value = [p0_dict[x[0]], p1_dict[x[1]], p2_dict[x[2]]] print('VALUES:', p0_dict[x[0]], p1_dict[x[1]], p2_dict[x[2]]) params = ["P1", "P2", "P3"] result = obj.findRuntime(value, params) return result pval = plopper_func(x) print('OUTPUT:%f' % pval)
choices=['cores', 'threads', 'sockets'], default_value='cores') cs.add_hyperparameters([p0, p1, p2, p3, p4, p5, p6]) # problem space task_space = None input_space = cs output_space = Space([Real(0.0, inf, name="time")]) dir_path = os.path.dirname(os.path.realpath(__file__)) kernel_idx = dir_path.rfind('/') kernel = dir_path[kernel_idx + 1:] obj = Plopper(dir_path + '/dlp.py', dir_path) x1 = ['p0', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6'] def myobj(point: dict): def plopper_func(x): x = np.asarray_chkfinite(x) # ValueError if any NaN or Inf value = [ point[x1[0]], point[x1[1]], point[x1[2]], point[x1[3]], point[x1[4]], point[x1[5]], point[x1[6]] ] print('VALUES:', point[x1[4]]) params = ["P0", "P1", "P2", "P3", "P4", "P5", "P6"] result = obj.findRuntime(value, params)