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
This commit is contained in:
Zheng-Ning Liu 2021-02-11 19:12:51 +08:00 committed by GitHub
parent 80135d4ef5
commit 81db43e669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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
# 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,6 +184,7 @@ def test(name, model_name, bs):
loss.backward()
opt.step()
else:
if name == "jittor":
x.sync()
sync()
for i in time_iter():