From 81db43e669fd3963079c70163b7077c0f796e341 Mon Sep 17 00:00:00 2001 From: Zheng-Ning Liu Date: Thu, 11 Feb 2021 19:12:51 +0800 Subject: [PATCH] Fix a bug in the performance test script (#168) * fix: pytorch tensors do not have .sync() method * feat: check if the docker image is already built --- python/jittor/test/perf/perf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/jittor/test/perf/perf.py b/python/jittor/test/perf/perf.py index 753b5383..a8b07bff 100644 --- a/python/jittor/test/perf/perf.py +++ b/python/jittor/test/perf/perf.py @@ -55,7 +55,11 @@ RUN pip3 install torch torchvision with open("/tmp/perf_dockerfile", 'w') as f: f.write(dockerfile_src) assert os.system("sudo nvidia-smi -lgc 1500") == 0 - assert os.system(f"sudo docker build --tag jittor/jittor-perf{suffix} -f /tmp/perf_dockerfile .") == 0 + + # if the docker image is not built + if os.system(f"sudo docker image inspect jittor/jittor-perf{suffix}"): + assert os.system(f"sudo docker build --tag jittor/jittor-perf{suffix} -f /tmp/perf_dockerfile .") == 0 + # run once for compile source jt_fps = test_main("jittor", "resnet50", 1) @@ -180,7 +184,8 @@ def test(name, model_name, bs): loss.backward() opt.step() else: - x.sync() + if name == "jittor": + x.sync() sync() for i in time_iter(): iter()