diff --git a/tune/model.py b/tune/model.py index 3961226ee..2b2d1a694 100644 --- a/tune/model.py +++ b/tune/model.py @@ -30,7 +30,7 @@ def train(X, Y, profiles): X = X[p,:] Y = Y[p,:] - #Train the model + #Train the.profile cut = int(1.00*M) CV = .1 XTr, YTr = X[:,:], Y[:,:] diff --git a/tune/optimize.py b/tune/optimize.py index d5e8c19eb..274d6d509 100644 --- a/tune/optimize.py +++ b/tune/optimize.py @@ -14,10 +14,10 @@ from numpy import cumsum import tools -fetch_types = [isc.templates.fetching_policy_type.FETCH_FROM_GLOBAL_CONTIGUOUS, - isc.templates.fetching_policy_type.FETCH_FROM_GLOBAL_STRIDED, - isc.templates.fetching_policy_type.FETCH_FROM_LOCAL, - isc.templates.fetching_policy_type.FETCH_FROM_LOCAL] +fetch_types = [isc.templates.FETCH_FROM_GLOBAL_CONTIGUOUS, + isc.templates.FETCH_FROM_GLOBAL_STRIDED, + isc.templates.FETCH_FROM_LOCAL, + isc.templates.FETCH_FROM_LOCAL] def exhaustive(template, sizes, context): tree, _ = tools.tree_of(template, sizes, context) diff --git a/tune/tools.py b/tune/tools.py index 04f02d892..30728fbb1 100644 --- a/tune/tools.py +++ b/tune/tools.py @@ -21,13 +21,13 @@ def expspace(a,b,N,r=128): def benchmark(template, setting, tree): queue = tree.context.queues[0] - queue.models[template, isc.float32] = isc.model(isc.float32, template(*setting), queue) + queue.profiles[template, isc.float32] = isc.profile(template(*setting), isc.float32, queue) times = [] total = 0 i = 0 while total < 1e-2: #z = isc.zeros(1, 10000000, isc.float32, tree.context) - z, events = isc.enqueue(tree) + z, events = isc.driver.enqueue(tree) tree.context.queues[0].synchronize() times.append(1e-9*sum([e.elapsed_time for e in events])) total += times[-1] diff --git a/tune/tune.py b/tune/tune.py index f8bca56c7..fecef0dcf 100644 --- a/tune/tune.py +++ b/tune/tune.py @@ -22,8 +22,8 @@ def pow2range(a, b): def tune(device, operation, json_path): #List devices - platforms = isc.get_platforms() - context = isc.context(device) + platforms = isc.driver.get_platforms() + context = isc.driver.context(device) #List of size tuples to use sizes = {} @@ -83,7 +83,7 @@ def tune(device, operation, json_path): predicted = profiles[0] else: clf = ensemble.RandomForestRegressor(min(10, idx+1), max_depth=min(10, idx+1)).fit(X, Y) - #clf, nrmse = model.train(X, Y, profiles) + #clf, nrmse = profile.train(X, Y, profiles) predperf = clf.predict(x)[0] best = (-predperf).argsort()[:5] perf = [performance(x, tools.benchmark(operation, profiles[b], tree)) for b in best] @@ -130,7 +130,7 @@ def tune(device, operation, json_path): json_data[operation_name]['float32'] = {} D = json_data[operation_name]['float32'] if len(profiles) > 1: - clf, nrmse = model.train(X, Y, profiles) + clf, nrmse = profile.train(X, Y, profiles) D['predictor'] = [{'children_left': e.tree_.children_left.tolist(), 'children_right': e.tree_.children_right.tolist(), 'threshold': e.tree_.threshold.astype('float64').tolist(), @@ -141,7 +141,7 @@ def tune(device, operation, json_path): def parse_arguments(): - platforms = isc.get_platforms() + platforms = isc.driver.get_platforms() devices = [d for platform in platforms for d in platform.get_devices()] #Command line arguments parser = argparse.ArgumentParser() @@ -156,7 +156,7 @@ def parse_arguments(): print("----------------") for (i, d) in enumerate(devices): selected = '[' + ('x' if device==d else ' ') + ']' - print selected , '-', isc.device_type_to_string(d.type), '-', d.name, 'on', d.platform.name + print selected , '-', isc.driver.device_type_to_string(d.type), '-', d.name, 'on', d.platform.name print("----------------") @@ -169,7 +169,7 @@ def parse_arguments(): if __name__ == "__main__": - isc.state.queue_properties = isc.CL_QUEUE_PROFILING_ENABLE + isc.driver.default.queue_properties = isc.driver.PROFILING_ENABLE args = parse_arguments() tune(*args)