Skip to content

Commit

Permalink
update open as json
Browse files Browse the repository at this point in the history
  • Loading branch information
elazarcoh committed May 26, 2024
1 parent d6bc3da commit c7c4dd1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/gpu-info-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export class RocmSmiService extends SmiService {
const jsonObj: json = await rocmSmiAsJsonObject();
const gpus: GpuInfo[] = [];
for (let [gpuId, gpuInfo] of Object.entries(jsonObj!)) {
if (!gpuId.includes("card"))
if (!gpuId.includes("card"))
continue

const gpuInfoFields: Record<string, number | string> = {};
for (const [name, field] of Object.entries(ROCM_SMI_FIELDS)) {
gpuInfoFields[name] = resolveGpuInfoField(
Expand Down Expand Up @@ -207,9 +207,18 @@ export async function nvidiaSmiAsJsonObject(): Promise<NvidiaSmiInfoJson> {
}

export async function openAsJsonFile(): Promise<void> {
const jsonObj = await nvidiaSmiAsJsonObject();
const exec = configurations.get("executablePath", undefined, "");
let jsonObj: json;
let fileName;
if (exec.includes("rocm")) {
jsonObj = await rocmSmiAsJsonObject()
fileName = "rocm-smi.json";
}
else {
jsonObj = await nvidiaSmiAsJsonObject();
fileName = "nvidia-smi.json";
}

const fileName = "nvidia-smi.json";
const newUri = vscode.Uri.file(fileName).with({
scheme: "untitled",
path: fileName,
Expand Down

0 comments on commit c7c4dd1

Please sign in to comment.