mirror of https://github.com/Jittor/Jittor
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:
parent
80135d4ef5
commit
81db43e669
|
@ -55,7 +55,11 @@ RUN pip3 install torch torchvision
|
||||||
with open("/tmp/perf_dockerfile", 'w') as f:
|
with open("/tmp/perf_dockerfile", 'w') as f:
|
||||||
f.write(dockerfile_src)
|
f.write(dockerfile_src)
|
||||||
assert os.system("sudo nvidia-smi -lgc 1500") == 0
|
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
|
# run once for compile source
|
||||||
jt_fps = test_main("jittor", "resnet50", 1)
|
jt_fps = test_main("jittor", "resnet50", 1)
|
||||||
|
|
||||||
|
@ -180,7 +184,8 @@ def test(name, model_name, bs):
|
||||||
loss.backward()
|
loss.backward()
|
||||||
opt.step()
|
opt.step()
|
||||||
else:
|
else:
|
||||||
x.sync()
|
if name == "jittor":
|
||||||
|
x.sync()
|
||||||
sync()
|
sync()
|
||||||
for i in time_iter():
|
for i in time_iter():
|
||||||
iter()
|
iter()
|
||||||
|
|
Loading…
Reference in New Issue