GPU: nvidia-smi or alternativ

Forums Desktop Info GPU: nvidia-smi or alternativ

Viewing 5 reply threads
  • Author
    Posts
    • #3511
      AvatarBazokaa
      Participant

      Hello,

      I am very impressed with the program “DesktopInfo”. I’ve done some work with it, but I’m not a hardcore programmer. I’m currently stuck at the problem that I want to read the GPU data.
      It should be best if its generic for NVDIDA, AMD and INTEL. I currently only have NVIDIA, so I’m just testing it with that.

      “DesktopInfo” can not natively read GPU data (or i dont know how). So I need a workaroud. I was able to read some data via nvidia-smi and the CMD window.
      Actually I could read my most important data whit this:

      #nvidia-smi --query-gpu=temperature.gpu, fan.speed, utilization.gpu, utilization.memory, pstate, memory.total, memory.used --format=csv

      But I have no idea how i can use it with CMD commands in “DesktopInfo” i tried different cases but everything failed.

      Can someone help and maybe has something ready?

      Regards David

      0
    • #3514
      GlennGlenn
      Keymaster

      post what you’ve tried so far.

      0
    • #3520
      AvatarBazokaa
      Participant

      Hello Glenn,

      unfortunately, I have to say that I haven’t been able to continue working here since last week.

      Below is the code for desktopinfo.ini.
      In the section # GPUTYPE i tried the different commands itself without cmd and also with cmd commands.

      In the cmd file, there is noting special, some few tries. In a nativ command window the command
      nvidia-smi --query-gpu=temperature.gpu --format=csv
      show me the tempreture (as example). But i cant include it in the script with
      CMD=...
      All important information for GPU monitoring could be
      #nvidia-smi --query-gpu=temperature.gpu, fan.speed, utilization.gpu, utilization.memory, pstate, memory.total, memory.used --format=csv"

      I am a little confused that no one has ever tried this before or that it has worked and that is why no one here has asked for help.

      If we can solved the GPU monitoring information into your “DesktopInfo”, it would be perfect. My next step would then be to implement it with AMD and INTEL. This should also be implemented in your sample code when we get it running.

      # Sample configuration file
      # See the manual for a full description of all options
      
      [options]
      
      # size and position
      top=0
      right=0
      
      width=235
      monitor-num=2
      allowdrag=0
      nav=0
      formcolor=000000
      transparency=50
      column1width=65
      
      # font
      font-face=Arial
      font-size=8
      
      # logging
      log=desktopinfo.log
      log-level=error
      
      #misc
      desktopinfo64=1
      ignore-setting-change=1
      
      # to use a language file, copy the 'sample-languages' folder to 'languages',
      # un-comment the following line and change it to your desired language
      # language=languages\german.ini
      
      [screen-saver]
      font-face=Comic Sans MS
      font-size=16
      centerv=1
      centerh=1
      
      [items]
      
      # colors
      set=key:White,value:#ffffff
      set=key:Grey,value:#909090
      set=key:Cyan,value:#00ffff
      set=key:Magenta,value:#ff00ff
      set=key:Green,value:#00ff00
      set=key:Orange,value:#ffd000
      set=key:Yellow,value:#ffff00
      set=key:Silver,value:#d0d0d0
      set=key:Blue,value:#0000f0
      set=key:Red,value:#ff0000
      
      # page 1
      PAGE=1
      PAGE-TITLE=Overview
      COLOR=%Cyan%
      
      # Date/Time
      COMMENT=	font-size:120%,	color:#ffffff,	style:iwb,text:Daves Overview V01
      DATETIME=	font-size:100%,	color:#b0ffb0,	interval:30,display:%9 %10
      BOOTTIME=	font-size:100%,	color:#b0ffb0, 	active:1,interval:0
      HOST=		font-size:100%,	color:#b0ffb0,	interval:0
      
      # CPUTYPE
      COMMENT=	font-size:120%,	color:#ffffff,	style:iwb,text:CPU Usage
      CPUTYPE=	row-text:CPU Type,font-size:100%,	color:#b0ffb0
      WMI=		font-size:100%,	color:#b0ffb0,	interval:1,text:CPU Info,namespace:root\cimv2,query:Win32_Processor,display:Cores:   %NumberOfCores%|Speed:  %MaxClockSpeed%MHz|Current: %CurrentClockSpeed%MHz
      
      #CPU Temperatur
      CORETEMP=	row-text:Temp: CPU,	font-size:100%,	color:#d0d0d0,	interval:1,	threshold2:1 70 #EE9900,threshold1:1 80 #ff0000,chart:line2 height:2 scale:linear max:100 series1:1 color1:#00ff00,display:%1%2 %chart%
      
      #CPU Usage
      CPUUSAGE=	row-text:CPU %1,			font-size:100%,	color:#d0d0d0,	interval:1,	threshold2:2 55 #EE9900,threshold1:2 95 #ff0000,chart:line2 scale:linear max:100 series1:2 color1:00ff00 row-id:1, display:%2[3.0d]% %chart%
      
      #RAM Usage
      PHYSICALRAM=row-text:RAM,				font-size:100%, color:#d0d0d0,	interval:30,threshold2:3 75 #EE9900,threshold1:3 90 #ff0000,chart:line2 height:2 scale:linear max:100 series1:3 color1:#00ff00,display:%1[3.1b]B / %2[3.1b]B (%3% used),	
      
      # GPUTYPE
      COMMENT=	font-size:120%,	color:#ffffff,	style:iwb,text:GPU Usage
      DISPLAYCONTROLLER=row-text:GPU Type,color:#b0ffb0
      
      #CMD=active:1,file:powershell.exe,directory:D:\Downloads\DesktopInfo290\nvidia-smi.bat
      #CMD=active:1,interval:3,file:cmd.exe,parameters:nvidia-smi, chart:line linear 100 4 00ff00,display:%4,text:GPU Usage,color:FFFFFF
      #nvidia-smi --query-gpu=temperature.gpu,	fan.speed,	utilization.gpu,	utilization.memory,	pstate,		memory.total,	memory.used	--format=csv
      
      # HDD / Disks
      COMMENT=	font-size:120%,	color:#ffffff,	style:iwb,text:HDD & Disks
      LOGICALDRIVES=row-text:Drive %1: | %3,	font-size:100%,	color:#b0ffb0,	interval:60,	diskio:0, chart:bar2 scale:linear max:100 series1:7 threshold:75 color1:#d0d0d0 color2:#EE9900 color3:#ff0000,threshold2:7 75 #EE9900, threshold1:7 90 #ff0000, display:%6[1.0B]B / %5[1.0B]B (%7[1.1f]% used)|%chart%|
      
      # UTILITY
      COLOR=%Cyan%
      COMMENT=	font-size:120%,	color:#ffffff,	style:iwb,text:Utility
      WMI=text:Bios,namespace:root\cimv2,query:Win32_Bios,display:%Caption%
      • This reply was modified 5 months ago by AvatarBazokaa.
      0
    • #3523
      AvatarBazokaa
      Participant

      I added a screenshot. I will replace the gadgets CPU Usage and GPU Meter.
      The operator should understand this at first sight. It should no longer be so colourful and childish. In the end just professional 🙂

      Attachments:
      0
    • #3525
      GlennGlenn
      Keymaster

      it looks like this is the code in question:

      #CMD=active:1,file:powershell.exe,directory:D:\Downloads\DesktopInfo290\nvidia-smi.bat
      #CMD=active:1,interval:3,file:cmd.exe,parameters:nvidia-smi, chart:line linear 100 4 00ff00,display:%4,text:GPU Usage,color:FFFFFF
      #nvidia-smi --query-gpu=temperature.gpu,	fan.speed,	utilization.gpu,	utilization.memory,	pstate,		memory.total,	memory.used	--format=csv
      

      notice how in the first line you fully qualify the batch file including extension but you haven’t done that in the second line.

      You didn’t post the batch file so I can’t comment on that. Your screen shot doesn’t show the CMD item in question, you commented it out. I don’t have a computer with an nvidia card so I can’t test it here.

      what is the output when you run the batch file from the command line?

      0
      • #3526
        AvatarBazokaa
        Participant

        Dear Glenn thank you.

        the two lines was for testing (relativ / absolut path) and where the sub skript could be startetd from.

        I habe two batch files for testing. I would prefer the first one, but in the end it doesn’t matter, the main thing is that it works then.

        1. nvidia-smi.cmd:
        nvidia-smi --query-gpu=temperature.gpu,fan.speed,utilization.gpu,utilization.memory,pstate, memory.total,memory.used,memory.free --format=csv

        The output is:

        temperature.gpu, fan.speed [%], utilization.gpu [%], utilization.memory [%], memory.total [MiB], memory.used [MiB], memory.free [MiB], pstate
        56, 0 %, 11 %, 4 %, 6144 MiB, 541 MiB, 5603 MiB, P0

        here would be all important information for available.

        2. get-nvidia-usage.cmd:

        for /f "tokens=1* delims= " %%i in ('C:\Windows\System32\nvidia-smi.exe -q ^| findstr /r /c:"^ *Gpu *:"') do (echo %%i)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Gpu *:"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Memory :*"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Total*:*"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Used*:*"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Free*:*"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Fan Speed *:"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *GPU Current Temp *:"') do (echo %%i %%j)
        for /f "tokens=1* delims= " %%i in ('nvidia-smi.exe -q ^| findstr /r /c:"^ *Performance State  *:"') do (echo %%i %%j)

        the output would be:

        Gpu
        Gpu : 11 %
        Memory : 4 %
        Memory Current Temp               : N/A
        Memory Max Operating Temp         : N/A
        Memory : 4006 MHz
        Memory : N/A
        Memory : N/A
        Memory : 4004 MHz
        Total : 6144 MiB
        Total : 256 MiB
        Total : N/A
        Total : N/A
        Total : N/A
        Total : N/A
        Used : 545 MiB
        Used : 229 MiB
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Used GPU Memory               : Not available in WDDM driver model
        Free : 5599 MiB
        Free : 27 MiB
        Fan Speed                             : 0 %
        GPU Current Temp                  : 61 C
        Performance State                     : P0

        but Im not very happy about this. There some lines where the names are not unique and i dont know how to filter it.

        With this command
        CMD= font-size:100%, color:#d0d0d0,row-text:GPU Usage,active:1,interval:1,hide-no-result:1,file:cmd.exe,parameters:/C nvidia-smi.cmd,trim,show-window:0,chart:line scale:linear max:100 series1:4 00ff00,display: Nr4: %4.2 %chart%
        I get (maybe) useful datas. Also a screenshot from the gui.

        • This reply was modified 5 months ago by AvatarBazokaa.
        0
    • #3531
      GlennGlenn
      Keymaster

      You’re getting closer to it. the third screenshot is showing the cmd output.

      Put a ‘@’ in front of the command in the nvidia-smi.cmd file:
      @nvidia-smi --query-gpu=temperature.gpu,fan.speed,utilization.gpu,utilization.memory,pstate, memory.total,memory.used,memory.free --format=csv

      that will stop the echo of the command line to the output.

      You won’t get a chart out of this. DTI has no idea where to look for the data in the output. The only way to get a chart is to make the cmd return a single number, no words, just a single value.

      It might be an interesting exercise to see if I can access the NVML api……

      • This reply was modified 5 months ago by GlennGlenn.
      0
Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Glenn's Page