forked from plambe/zabbix-nvidia-smi-multi-gpu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_gpus_info.bat
35 lines (30 loc) · 854 Bytes
/
get_gpus_info.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
echo {
echo "data":[
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe" -L`) DO (
if !count! GTR 1 echo ,
SET line=%%F
SET var!count!=%%F
SET /a count=!count!+1
for /f "tokens=1 delims=:" %%A in ('echo %%F') do (
for /f "tokens=2 delims= " %%B in ('echo %%A') do (
echo|set /p={"{#GPUINDEX}":"
echo|set /p=%%B", "
)
)
for /f "tokens=3 delims=:" %%A in ('echo %%F') do (
echo|set /p={#GPUUUID}":"
for /f "tokens=1 delims= " %%B in ('echo %%A') do (
for /f "tokens=1 delims=)" %%C in ('echo %%B') do (
echo|set /p=%%C"}
)
)
rem echo|set /p=
)
)
echo.
echo ]
echo }
ENDLOCAL