Git Product home page Git Product logo

Comments (5)

sansmoraxz avatar sansmoraxz commented on June 3, 2024 1

glxinfo from mesa-utils appears to provide the GPU memory at least.

> glxinfo -B
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 4096 MB
    Total available memory: 4096 MB
    Currently available dedicated video memory: 3105 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 535.129.03
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 535.129.03
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 535.129.03
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

I don't have an AMD GPU to test this out. @tumist could you confirm if the tool works in AMD too? Also if someone got intel graphics to compare too, would be helpful.

If it works I can open a PR regarding this.

from tophat.

tumist avatar tumist commented on June 3, 2024

There is currently no unified API to get these measurements. Ideally they would come from libgtop, and although there was an attempt to add GPU usage to libgtop it was not merged.

My computer has an AMD graphics card and it's rather easy to get measurements from the amdgpu driver through sysfs. I don't have access to a computer with an nvidia graphics card (and even so there are at least two different drivers, no?) so I can't work on that.

from tophat.

sansmoraxz avatar sansmoraxz commented on June 3, 2024

You may take a look at this repo for Nvidia implementation:
https://github.com/UshakovVasilii/gnome-shell-extension-freon/blob/55bcd7c48181c8c18a9210828b8723ac3fe1d4c7/freon%40UshakovVasilii_Github.yahoo.com/nvidiaUtil.js#L142

Although there are no standard tooling I think you can probably call libgtop for the gpu vendor info. Or just check for availability of GPU specific CLI tools. Next call the corresponding tools for info.

from tophat.

sansmoraxz avatar sansmoraxz commented on June 3, 2024

Also I got an NVIDIA driver here's all the GPU info options you can poll:

https://gist.github.com/sansmoraxz/8a98d987f12d7edc983d611b8326fc67

Hope it helps.

from tophat.

getlogname avatar getlogname commented on June 3, 2024

It works with an AMD GPU too, here is what I got:

> glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon RX 7900 XT (gfx1100, LLVM 16.0.6, DRM 3.54, 6.6.7-100.fc38.x86_64) (0x744c)
    Version: 23.1.9
    Accelerated: yes
    Video memory: 20480MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 19821 MB, largest block: 19821 MB
    VBO free aux. memory - total: 15932 MB, largest block: 15932 MB
    Texture free memory - total: 19821 MB, largest block: 19821 MB
    Texture free aux. memory - total: 15932 MB, largest block: 15932 MB
    Renderbuffer free memory - total: 19821 MB, largest block: 19821 MB
    Renderbuffer free aux. memory - total: 15932 MB, largest block: 15932 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 20480 MB
    Total available memory: 36486 MB
    Currently available dedicated video memory: 19821 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 7900 XT (gfx1100, LLVM 16.0.6, DRM 3.54, 6.6.7-100.fc38.x86_64)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.1.9
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.1.9
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.1.9
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

from tophat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.