We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1ec2cb commit 3bde116Copy full SHA for 3bde116
1 file changed
cli/per_gpu.py
@@ -221,7 +221,20 @@ def main_per_gpu(gpu, opts):
221
return False
222
223
cc_mode = gpu.query_cc_mode()
224
- info(f"{gpu} CC mode is {cc_mode}")
+ output_data = {
225
+ "gpu_bdf": str(gpu.bdf),
226
+ "cc_mode": cc_mode
227
+ }
228
+ print(json.dumps(output_data))
229
+
230
+ if opts.output_json_file:
231
+ try:
232
+ with open(opts.output_json_file, 'w') as f:
233
+ json.dump(output_data, f, indent=4)
234
+ info(f"CC mode query result written to {opts.output_json_file}")
235
+ except IOError as e:
236
+ error(f"Failed to write CC mode query result to {opts.output_json_file}: {e}")
237
+ return False
238
239
if opts.output_json_file:
240
output_data = {
0 commit comments