Add Torch CUDA sync to fix timing code in cli.py (#147)

Co-authored-by: Neil Movva <[email protected]>
This commit is contained in:
Neil Movva
2024-09-13 11:47:16 +02:00
committed by GitHub
co-authored by Neil Movva
parent d013dc4d3f
commit 87f6fff727
+3
View File
@@ -215,6 +215,9 @@ def main(
x = unpack(x.float(), opts.height, opts.width)
with torch.autocast(device_type=torch_device.type, dtype=torch.bfloat16):
x = ae.decode(x)
if torch.cuda.is_available():
torch.cuda.synchronize()
t1 = time.perf_counter()
fn = output_name.format(idx=idx)