gpuopenanalytics / pynvml

Provide Python access to the NVML library for GPU diagnostics
BSD 3-Clause "New" or "Revised" License
212 stars 31 forks source link

Comparison with other Python NVML bindings #2

Open jakirkham opened 5 years ago

jakirkham commented 5 years ago

Have noticed there are a few other implementations of Python NVML bindings. It seems worthwhile to compare these to see what they offer and how they differ (particularly from what is here).

jakirkham commented 5 years ago

Copying the authors of these other implementations in case they have thoughts on what was missing in the original package and what could be improved, @lukeyeager @nicolargo @fbcotter @jonsafari.

fbcotter commented 5 years ago

Not a lot was wrong or missing with the original, for me it was mainly:

Most of the work I've done on py3nvml has been addressing these issues and adding in some extra utility functions that I've found useful, but could easily be moved to another library.

Keeping up to date with nvml is hard, for example there was another release 5 days ago - 418.56 which already makes py3nvml slightly behind.

kenhester commented 5 years ago

Hi Fergal,

Agreed the nvml bindings are out of data. This was an outstanding action (and a large task) to upgrade the code.

I did review the py3nvml, the added docstrings to the nvml functions are nice. Where these descriptions of parameters, enumeration, return codes and functions sourced from the online documentation?

Ken Hester | NVIDIA Solutions Architect c: 832-216-8736 khester@nvidia.commailto:khester@nvidia.com

From: Fergal Cotter notifications@github.com Sent: Monday, March 25, 2019 12:20 PM To: gpuopenanalytics/pynvml pynvml@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [gpuopenanalytics/pynvml] Comparison with other Python NVML bindings (#2)

Not a lot was wrong or missing with the originalhttps://pypi.org/project/nvidia-ml-py/, for me it was mainly:

Most of the work I've done on py3nvml has been addressing these issues and adding in some extra utility functions that I've found useful, but could easily be moved to another library.

Keeping up to date with nvml is hard, for example there was another release 5 days ago - 418.56https://github.com/NVIDIA/nvidia-settings/releases/tag/418.56 which already makes py3nvml slightly behind.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gpuopenanalytics/pynvml/issues/2#issuecomment-476296864, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASakVX_A4jimercNmxcG-m7y5ZzruRmxks5vaQU2gaJpZM4cEqeQ.


This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

fbcotter commented 5 years ago

Hi Ken,

The descriptions and dosctrings were taken from the latest nvml header file https://github.com/NVIDIA/nvidia-settings/blob/master/src/nvml.h. I've just copied them over for each function as a guide.

They are sadly not only in a non-pythonic shape, but incorrect. The python functions return the result and raise exceptions, whereas the docstring implies you need to pass the destination for the result as a parameter and interrogate the return value for errors.

They look like they've been formatted to automatically generate nice documentation on NVIDIA developer zone, I'd hoped to change them a little so that they would work with sphinx and we could get readthedocs style documentation for the functions, but I couldn't see an easy way to do this without painstakingly reformatting them by hand.

lukeyeager commented 5 years ago

Looks to me like all the other repos listed start with the old "official" python2-compliant bindings from NVIDIA and update them.

In my repo (https://github.com/lukeyeager/pynvml), I started from scratch. I mostly just wanted to show off how cool pybind11 is. The amount of code is super tiny (see here), but the number of supported functions is super low.

mrocklin commented 5 years ago

That's pretty cool. I think it'd be great for a more modern Python binding around nvml to exist.

@lukeyeager do you have any intentions on continuing your work?

Personally as more of an end-user, I'm more excited about seeing functionality built on top of pynvml (like dashboards) than in the underlying wrapping technology. I'm personally inclined to build off of what's here (as archaic as it may be) until something nicer exists. If something nicer did exist (*nudges @lukeyeager) that'd be swell :)

lukeyeager commented 5 years ago

@mrocklin not right now, no. But you basically only need to go through the nvml header and add the rest of the APIs (IIRC). Have at it, if you like!

patrikhuber commented 4 years ago

It looks like NVIDIA has also updated their bindings on PyPi nvidia-ml-py to version 10.418.84 in 2019 https://pypi.org/project/nvidia-ml-py/#history. pip install nvidia-ml-py will still give a weird nvidia-ml-py-375.53.tar.gz version that I can nowhere find on PyPi but pip install nvidia-ml-py==10.418.84 does the trick for me. That version looks like it's working with Python 3 too.

I am guessing that this is the best choice to use now?

jakirkham commented 4 years ago

We’ve been updating and using pynvml. It’s used in JupyterLab dashboards and Dask clusters.

Mostly this conversation was spurred out of an interest in figuring out what role this library plays in this space. As well as trying to figure out how best to support the community with it.