<p>Hi. I searched google for this few days but unfortunately i got nothing.</p>
<p>What i want is to get GPU informations like </p>
<ol>
<li><p>Vender *AMD or Nvidia</p></li>
<li><p>Vram *3GB for instance</p></li>
<li><p>Name or Model Generation *Pascal GTX1060 for instance</p></li>
</ol>
<p>(Option) Overclocking or Downclocking if it possible</p>
<p>Hope it can be worked in various platforms but Windows will be main.</p>
<p>Any possible ways? Thanks :)</p>
<hr/>**评论:**<br/><br/>Redundancy_: <pre><p>Generally speaking, this is a far more complicated and wider issue than befits the Golang subreddit. You'd be better off asking on specialist forums what the best way of doing it overall is, and then consider what the best way of getting to that information in Go is.</p>
<p>My vague memory from a few years ago:
Vram used to be very difficult to determine, as it wasn't reliably reported. You used to have to use the graphics APIs to force allocations that had to live in dedicated memory till it failed, iirc.
Name was also dodgy, as various drivers override it in certain sources.
DeviceIDs were better for identification, but vendors weren't good at updating their references.</p></pre>SaturnsVoid: <pre><p>For windows you can make a command prompt call like so; </p>
<blockquote>
<pre><code>func getGPU() string {
Info := exec.Command("cmd", "/C", "wmic path win32_VideoController get name")
Info.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
History, _ := Info.Output()
return stripSpaces(strings.Replace(string(History), "Name", "", -1))
}
</code></pre>
</blockquote></pre>ilbekilier: <pre><p>Oh, finally got working solution. At least for Windows.
Thank you so much!</p></pre>t4nkbusta: <pre><p>I've had to do something similar for a project and I'm using cgo and opencl but I'm also using opencl for other things besides getting GPU info :) <a href="https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clGetDeviceInfo.html" rel="nofollow">https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clGetDeviceInfo.html</a></p></pre>ChristophBerger: <pre><p>My first impulse was to suggest <a href="https://github.com/kolide/osquery-go" rel="nofollow">osquery-go</a> that connects to the awesome <a href="https://osquery.io" rel="nofollow">osquery</a> framework that exposes all kind of system information via SQL queries, but it seems that GPU information <a href="https://github.com/kolide/osquery-go" rel="nofollow">is not covered</a>.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传