Hacker News new | ask | show | jobs
by Hizonner 670 days ago
I have also never programmed on Windows in my life. Seriously, not so much as a trivial script.

But I would look up the right way to find the system installation if I were writing production code, or even personal-use code, that needed to know where it was. I also wouldn't walk the filesystem looking for a program I was relying on (and assuming filenames and installation locations, but evidently not with a definitive standard location in mind). If I had to do that, I would know there was something horribly wrong with my own design. Although I should probably already be clued into that if my chat program is having to fool with GPU arcana like that.

Either some programmer has put thousands of other people's reliability and resources at risk by intentionally taking on something they're unqualified for and don't have the time to do right... or some manager has pushed somebody into that position.

If you mean that the reality of commercial software is that it's written by half-qualified people under unreasonable time pressure, why should we have "empathy" for the people who make it that way?

2 comments

So what's the enterprise-quality solution for querying the GPU for the information they need?

If I search Google for "nvidia-smi.exe", one of the top results is a Stack Overflow answer with 70 upvotes, describing exactly the approach taken by the linked code.

https://stackoverflow.com/a/57100016

Sounds like, at best, a great way to find obsolete copies of nvidia-smi.exe shipped with installed but inactive driver versions.

On all my Windows/Nvidia systems, the current version of nvidia-smi.exe is present in %SystemRoot%\System32.

OTOH, …\FileRepository*\nvidia-smi.exe matches anywhere from one to eight versions, dating back to 2023.

Perhaps this is only true because I use official Nvidia mechanisms (.exe installer from Nvidia Web site or Nvidia-supplied app) to install drivers, rather than Windows Update or INF install?

Incidentally, the wildcard …\FileRepository\nvdm* suggested in the Stack Overflow answer returns zero directories on my systems, as all Nvidia driver repository directories start with either nv_dispi (GeForce) or nv_dispwi (workstation).

Which makes sense, because obviously the INF file name used to generate these directory names is subject to change without notice.

In any case, per "nvidia-smi --help":

  Note that the functionality of NVSMI is exposed through the NVML C-based
  library. See the NVIDIA developer website for more information about NVML.
  Python wrappers to NVML are also available.  The output of NVSMI is
  not guaranteed to be backwards compatible; NVML and the bindings are backwards
  compatible.
  
  http://developer.nvidia.com/nvidia-management-library-nvml/
  http://pypi.python.org/pypi/nvidia-ml-py/
From the repo:

> This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 600 versions published, up to 8 mio downloads per month, > 300 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!

It's fair to blast Discord here, but not the library's authors. When you want "production code", maybe do better* than npm-installing a project with lifetime donations of, let's see, $624.

* Like donate, audit and upstream improvements, or build it yourself from scratch.