Simple linear model

This commit is contained in:
Philippe Tillet
2014-09-28 19:37:56 -04:00
parent 693b8b67b0
commit 0eb56a10f0
4 changed files with 87 additions and 33 deletions

View File

@@ -122,17 +122,17 @@ def benchmark(template, statement, device):
if occupancy_record.occupancy < 15 :
raise ValueError("Template has too low occupancy")
else:
try:
template.execute(statement, True)
#~ try:
template.execute(statement, True)
statement.result.context.finish_all_queues()
N = 0
current_time = 0
while current_time < 1e-2:
time_before = time.time()
template.execute(statement,False)
statement.result.context.finish_all_queues()
N = 0
current_time = 0
while current_time < 1e-2:
time_before = time.time()
template.execute(statement,False)
statement.result.context.finish_all_queues()
current_time += time.time() - time_before
N+=1
return current_time/N
except:
raise ValueError("Invalid template")
current_time += time.time() - time_before
N+=1
return current_time/N
#~ except:
#~ raise ValueError("Invalid template")