Skip to content

Commit a5f3171

Browse files
committed
Optimize configuration record in .json
1 parent 3a80249 commit a5f3171

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

graph_net/torch/test_compiler.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,9 @@ def test_single_model(args):
160160
"configuration": {
161161
"model": os.path.basename(os.path.normpath(args.model_path)),
162162
"device": args.device,
163-
"cpu": platform.processor(),
164-
"cuda_gpu": torch.cuda.get_device_name(0)
165-
if args.device == "cuda"
166-
else None,
163+
"device_name": None,
167164
"compiler": args.compiler,
168-
"torch_version": torch.__version__,
165+
"compiler_framework_version": None,
169166
"warmup": args.warmup,
170167
"trials": args.trials,
171168
},
@@ -177,6 +174,22 @@ def test_single_model(args):
177174
},
178175
}
179176

177+
if args.device == "cuda":
178+
result_data["configuration"]["device_name"] = (torch.cuda.get_device_name(0),)
179+
elif args.device == "cpu":
180+
result_data["configuration"]["device_name"] = (platform.processor(),)
181+
else:
182+
result_data["configuration"]["device_name"] = "unknown"
183+
184+
if args.compiler == "inductor":
185+
result_data["configuration"]["compiler_framework_version"] = torch.__version__
186+
elif args.compiler == "tensorrt":
187+
result_data["configuration"][
188+
"compiler_framework_version"
189+
] = f"TensorRT {torch_tensorrt.__version__}"
190+
else:
191+
result_data["configuration"]["compiler_version"] = "unknown"
192+
180193
eager_model_call = lambda: model(**input_dict)
181194
compiled_model_call = lambda: compiled_model(**input_dict)
182195

0 commit comments

Comments
 (0)