rasbt / watermark

An IPython magic extension for printing date and time stamps, version numbers, and hardware information
Other
894 stars 92 forks source link

GPU Info #90

Closed 907Resident closed 1 year ago

907Resident commented 1 year ago

TL;DR

Overall, I wanted an argument in watermark to allow the user to view GPU information.

Details

rasbt commented 1 year ago

Awesome! This is a very exciting PR! Thanks!

rasbt commented 1 year ago

I just tried it on a machine with NVIDIA GPUs, and it couldn't find these. How did it look on your machine, am I missing any requirements @907Resident ?

Screenshot 2023-05-22 at 2 06 05 PM
907Resident commented 1 year ago

Hi @rasbt,

I think I accidentally provided the incorrect pythonic interface for the gpu. As I mentioned in commit 87e7201, the correct package is py3nvml.

I have made the correction, and the change can be seen in this Colab notebook (assuming the user has Colab Pro with GPU). The output can be viewed below.

image

907Resident commented 1 year ago

I also noticed that as of commit ab5cf05, that the automated checks have failed. But my local execution of pytest appears to be working:

image

But for some reason that I do no understand, the automated CI process is unable to install py3nvml.

image

Nonetheless, I think once py3nvml is installed, I believe that you will be able to get the name of the GPU being used with my additions. If there is more functionality that you want to see, just let me know.

rasbt commented 1 year ago

Thanks for the update! I did some fixes in the formatting and the CI works now! I'll also try it on a non-Colab GPU machine to make sure.

rasbt commented 1 year ago

Seems to work (see screenshot below). I think if there's a single GPU,

GPU Info: GPU 0: NVIDIA A100-SXM4-40GB

would look fine. But if there are more than one, perhaps

GPU Info:
  GPU 0: NVIDIA A100-SXM4-40GB
  GPU 1: NVIDIA A100-SXM4-40GB
  GPU 2: NVIDIA A100-SXM4-40GB
  GPU 3: NVIDIA A100-SXM4-40GB
  GPU 4: NVIDIA A100-SXM4-40GB
  GPU 5: NVIDIA A100-SXM4-40GB
  GPU 6: NVIDIA A100-SXM4-40GB
  GPU 7: NVIDIA A100-SXM4-40GB
Screenshot 2023-05-23 at 11 08 43 AM
rasbt commented 1 year ago

I changed it to always use the indentation now. In hindsight, I think this should look better since it avoids the double-colon.

I.e., it's now

GPU Info:
  GPU 0: NVIDIA A100-SXM4-40GB
  GPU 1: NVIDIA A100-SXM4-40GB
  GPU 2: NVIDIA A100-SXM4-40GB
  GPU 3: NVIDIA A100-SXM4-40GB
  GPU 4: NVIDIA A100-SXM4-40GB
  GPU 5: NVIDIA A100-SXM4-40GB
  GPU 6: NVIDIA A100-SXM4-40GB
  GPU 7: NVIDIA A100-SXM4-40GB

or

GPU Info:
  GPU 0: NVIDIA A100-SXM4-40GB
907Resident commented 1 year ago

Thanks for the updates and integrating my changes.

I changed it to always use the indentation now. In hindsight, I think this should look better since it avoids the double-colon.

I.e., it's now

GPU Info:
  GPU 0: NVIDIA A100-SXM4-40GB
  GPU 1: NVIDIA A100-SXM4-40GB
  GPU 2: NVIDIA A100-SXM4-40GB
  GPU 3: NVIDIA A100-SXM4-40GB
  GPU 4: NVIDIA A100-SXM4-40GB
  GPU 5: NVIDIA A100-SXM4-40GB
  GPU 6: NVIDIA A100-SXM4-40GB
  GPU 7: NVIDIA A100-SXM4-40GB

or

GPU Info:
  GPU 0: NVIDIA A100-SXM4-40GB

Yes, I agree. I only have access to a machine with one GPU; so, I did not think about formatting for multiple GPUs. But your formatting looks much better.

@rasbt, at this point what do we need to do to merge this PR? Anything else you need me to add?

rasbt commented 1 year ago

@907Resident It looks all good to me know! Just added a changelog entry and am happy to merge (and make version release then)! Thanks so much for the PR. It's a super nice contribution!

907Resident commented 1 year ago

Cool, sounds good!