"vscode:/vscode.git/clone" did not exist on "2bd076e42e667b720e145de448e6d9d84ee5cd2c"
Commit 0f7d5123 authored by Paul's avatar Paul
Browse files

Fixes

parent 64285523
import os, json, subprocess, tempfile, sys, argparse
import os, json, subprocess, tempfile, sys, argparse, contextlib
@contextlib.contextmanager
def tmp_file(dump=None):
tmp_name = None
try:
with tempfile.NamedTemporaryFile(mode='w+', delete=False) as f:
tmp_name = f.name
if dump:
dump(f)
yield tmp_name
finally:
os.unlink(tmp_name)
def pretty_print(obj):
print(json.dumps(obj, indent=4))
def benchmark_one(config, tuning):
with tempfile.NamedTemporaryFile(mode="w+") as tf:
b = {
'settings': {
'iterations': 100
},
'compile_op': {
'name': 'ck_gemm',
'tuning_val': tuning,
'inputs': config
}
b = {
'settings': {
'iterations': 100
},
'compile_op': {
'name': 'ck_gemm',
'tuning_val': tuning,
'inputs': config
}
json.dump(b, tf)
cp = subprocess.run('./bin/gpu-driver {}'.format(tf.name),
capture_output=True)
}
print(b)
with tmp_file(lambda tf: json.dump(b, tf)) as tf:
cp = subprocess.run('./bin/gpu-driver {}'.format(tf),
capture_output=True, shell=True)
for line in cp.stdout.decode().split("\n"):
s = line.strip()
if not s:
continue
fields = s.split(',')
dtime = fields[-1].strip()
print(dtime)
return float(dtime[:-2])
return sys.float_info.max
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment